re PR c++/28505 (ICE with invalid constructors)

PR c++/28505
        * decl.c (grokdeclarator): Return early after
        issuing diagnostic about an incomplete type.

        * g++.dg/parse/ctor7.C: New test.
        * g++.dg/parse/ctor8.C: Likewise.

From-SVN: r116302
This commit is contained in:
Lee Millward 2006-08-21 17:34:44 +00:00 committed by Lee Millward
parent 18ff35c669
commit 623c65f173
5 changed files with 33 additions and 2 deletions

View File

@ -3,6 +3,10 @@
PR c++/26269
* decl.c (duplicate_decls): Return early if either
newdecl or olddecl is error_mark_node.
PR c++/28505
* decl.c (grokdeclarator): Return early after
issuing diagnostic about an incomplete type.
2006-08-20 Mark Mitchell <mark@codesourcery.com>

View File

@ -8354,8 +8354,7 @@ grokdeclarator (const cp_declarator *declarator,
error (" in instantiation of template %qT",
current_class_type);
type = error_mark_node;
decl = NULL_TREE;
return error_mark_node;
}
else
{

View File

@ -2,6 +2,10 @@
PR c++/26269
* g++.dg/other/error14.C: New test.
PR c++/28505
* g++.dg/parse/ctor7.C: New test.
* g++.dg/parse/ctor8.C: Likewise.
2006-08-21 Olivier Hainque <hainque@adacore.com>

View File

@ -0,0 +1,15 @@
//PR c++/28505
struct A
{
A : (); // { dg-error "primary-expression|incomplete type" }
A : (int); // { dg-error "primary-expression|incomplete type|'int'" }
};
struct B
{
char c;
A a;
};
B b = (B){0}; // { dg-error "compound-literals" }

View File

@ -0,0 +1,9 @@
//PR c++/28505
struct A
{
A : (); // { dg-error "primary-expression|incomplete type" }
A : (int); // { dg-error "primary-expression|incomplete type|'int'" }
};
A a = (A){0}; // { dg-error "too many initializers|compound-literals" }