From: Paolo Carlini Date: Fri, 21 Mar 2014 16:35:26 +0000 (+0000) Subject: re PR c++/60384 ([c++1y] ICE with invalid typedef) X-Git-Tag: releases/gcc-4.9.0~356 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=279d3eb8f8f81021d727b7c1c349cebc72ce29a3;p=thirdparty%2Fgcc.git re PR c++/60384 ([c++1y] ICE with invalid typedef) /cp 2014-03-21 Paolo Carlini PR c++/60384 * name-lookup.c (push_class_level_binding_1): Check identifier_p on the name argument. /testsuite 2014-03-21 Paolo Carlini PR c++/60384 * g++.dg/cpp1y/pr60384.C: New. From-SVN: r208752 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3d043d95f130..1acfec335f64 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-03-21 Paolo Carlini + + PR c++/60384 + * name-lookup.c (push_class_level_binding_1): Check identifier_p + on the name argument. + 2014-03-20 Jakub Jelinek PR c++/60572 diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index ea16061f2ae7..53f14f3eee61 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -3115,6 +3115,13 @@ push_class_level_binding_1 (tree name, tree x) if (name == error_mark_node) return false; + /* Can happen for an erroneous declaration (c++/60384). */ + if (!identifier_p (name)) + { + gcc_assert (errorcount || sorrycount); + return false; + } + /* Check for invalid member names. But don't worry about a default argument-scope lambda being pushed after the class is complete. */ gcc_assert (TYPE_BEING_DEFINED (current_class_type) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a04e2d02896f..a57529844c8f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-03-21 Paolo Carlini + + PR c++/60384 + * g++.dg/cpp1y/pr60384.C: New. + 2014-03-21 Jakub Jelinek PR target/60598 diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60384.C b/gcc/testsuite/g++.dg/cpp1y/pr60384.C new file mode 100644 index 000000000000..f206647e6408 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr60384.C @@ -0,0 +1,9 @@ +// PR c++/60384 +// { dg-do compile { target c++1y } } + +template int foo(); + +struct A +{ + typedef auto foo<>(); // { dg-error "typedef declared 'auto'" } +};