X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Fcp%2Fparser.c;h=765991fb482148d767fbfd515f7027283507c2b0;hp=f38f6fbc78f1fa13909a0982e3818965b6a8280b;hb=4cbba981b3d1de4043ae5570ed552382a24a939f;hpb=7ff3aeed0b9abf2fbefa0bc3bca638d070f36f20 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index f38f6fbc78f..765991fb482 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -11107,15 +11107,8 @@ cp_parser_direct_declarator (cp_parser* parser, 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; @@ -12849,9 +12842,17 @@ cp_parser_class_head (cp_parser* parser, 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 {};