diff options
author | Andrew Pinski <andrew_pinski@playstation.sony.com> | 2009-03-27 13:36:33 +0000 |
---|---|---|
committer | H.J. Lu <hjl@gcc.gnu.org> | 2009-03-27 06:36:33 -0700 |
commit | 8ec0d73b3487b8beaddb0bd6873934a183fa8a8f (patch) | |
tree | 44c907cf2c62b7aa65f16b98eab7e98cdb9f1609 /gcc/cp | |
parent | b0957daf070e13e7c298370996e2db3a6ca3c959 (diff) | |
download | gcc-8ec0d73b3487b8beaddb0bd6873934a183fa8a8f.zip gcc-8ec0d73b3487b8beaddb0bd6873934a183fa8a8f.tar.gz gcc-8ec0d73b3487b8beaddb0bd6873934a183fa8a8f.tar.bz2 |
re PR c++/38638 (ICE superfluous 'typename')
gcc/cp/
2009-03-27 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR c++/38638
* parser.c (cp_parser_elaborated_type_specifier): If we have a
typename tag and don't have either a TYPE_DECL or a
TEMPLATE_ID_EXPR, set the type to NULL.
gcc/testsuite/
2009-03-27 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR c++/38638
* g++.dg/template/typename17.C: New testcase.
* g++.dg/template/typename18.C: New testcase.
From-SVN: r145107
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/parser.c | 6 |
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d120594..6fcd92a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2009-03-27 Andrew Pinski <andrew_pinski@playstation.sony.com> + + PR c++/38638 + * parser.c (cp_parser_elaborated_type_specifier): If we have a + typename tag and don't have either a TYPE_DECL or a + TEMPLATE_ID_EXPR, set the type to NULL. + 2009-03-27 Simon Martin <simartin@users.sourceforge.net> PR c++/37647 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 02a96cc..63ac070 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -11588,7 +11588,11 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, type = make_typename_type (parser->scope, decl, typename_type, /*complain=*/tf_error); - else + /* If the `typename' keyword is in effect and DECL is not a type + decl. Then type is non existant. */ + else if (tag_type == typename_type && TREE_CODE (decl) != TYPE_DECL) + type = NULL_TREE; + else type = TREE_TYPE (decl); } |