bounds = fold_non_dependent_expr (bounds);
/* Normally, the array bound must be an integral constant
expression. However, as an extension, we allow VLAs
- in function scopes. And, we allow type-dependent
- expressions in templates; sometimes we don't know for
- sure whether or not something is a valid integral
- constant expression until instantiation time. (It
- doesn't make sense to check for value-dependency, as
- an expression is only value-dependent when it is a
- constant expression.) */
- else if (!type_dependent_expression_p (bounds)
- && !at_function_scope_p ())
+ in function scopes. */
+ else if (!at_function_scope_p ())
{
error ("array bound is not an integer constant");
bounds = error_mark_node;
CLASSTYPE_DECLARED_CLASS (type) = (class_key == class_type);
cp_parser_check_class_key (class_key, type);
+ /* If this type was already complete, and we see another definition,
+ that's an error. */
+ if (type != error_mark_node && COMPLETE_TYPE_P (type))
+ {
+ error ("redefinition of %q#T", type);
+ cp_error_at ("previous definition of %q#T", type);
+ type = error_mark_node;
+ }
+
/* We will have entered the scope containing the class; the names of
- base classes should be looked up in that context. For example,
- given:
+ base classes should be looked up in that context. For example:
struct A { struct B {}; struct C; };
struct A::C : B {};