static tree grok_reference_init (tree, tree, tree, int);
static tree grokvardecl (tree, tree, tree, const cp_decl_specifier_seq *,
int, int, int, bool, int, tree);
-static int check_static_variable_definition (tree, tree);
+static void check_static_variable_definition (tree, tree);
static void record_unknown_type (tree, const char *);
static tree builtin_function_1 (tree, tree, bool);
static int member_function_or_else (tree, tree, enum overload_flags);
/* DECL is a VAR_DECL defined in-class, whose TYPE is also given.
Check to see that the definition is valid. Issue appropriate error
- messages. Return 1 if the definition is particularly bad, or 0
- otherwise. */
+ messages. */
-static int
+static void
check_static_variable_definition (tree decl, tree type)
{
/* Avoid redundant diagnostics on out-of-class definitions. */
if (!current_class_type || !TYPE_BEING_DEFINED (current_class_type))
- return 0;
+ ;
/* Can't check yet if we don't know the type. */
- if (dependent_type_p (type))
- return 0;
+ else if (dependent_type_p (type))
+ ;
/* If DECL is declared constexpr, we'll do the appropriate checks
in check_initializer. Similarly for inline static data members. */
- if (DECL_P (decl)
+ else if (DECL_P (decl)
&& (DECL_DECLARED_CONSTEXPR_P (decl)
|| undeduced_auto_decl (decl)
|| DECL_VAR_DECLARED_INLINE_P (decl)))
- return 0;
+ ;
else if (cxx_dialect >= cxx11 && !INTEGRAL_OR_ENUMERATION_TYPE_P (type))
{
if (!COMPLETE_TYPE_P (type))
error_at (DECL_SOURCE_LOCATION (decl),
"in-class initialization of static data member %q#D of "
"non-literal type", decl);
- return 1;
}
-
/* Motion 10 at San Diego: If a static const integral data member is
initialized with an integral constant expression, the initializer
may appear either in the declaration (within the class), or in
the definition, but not both. If it appears in the class, the
member is a member constant. The file-scope definition is always
required. */
- if (!ARITHMETIC_TYPE_P (type) && TREE_CODE (type) != ENUMERAL_TYPE)
- {
- error_at (DECL_SOURCE_LOCATION (decl),
- "invalid in-class initialization of static data member "
- "of non-integral type %qT",
- type);
- return 1;
- }
+ else if (!ARITHMETIC_TYPE_P (type) && TREE_CODE (type) != ENUMERAL_TYPE)
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "invalid in-class initialization of static data member "
+ "of non-integral type %qT",
+ type);
else if (!CP_TYPE_CONST_P (type))
error_at (DECL_SOURCE_LOCATION (decl),
"ISO C++ forbids in-class initialization of non-const "
pedwarn (DECL_SOURCE_LOCATION (decl), OPT_Wpedantic,
"ISO C++ forbids initialization of member constant "
"%qD of non-integral type %qT", decl, type);
-
- return 0;
}
/* *expr_p is part of the TYPE_SIZE of a variably-sized array. If any