Hi,

in this minor regression we ICE during error recovery, when push_class_level_binding_1 (called by finish_member_declaration via pushdecl_class_level) gets a TEMPLATE_ID_EXPR as the name argument. It's a regression because, since r199779, invalid declarations get more often through (with TREE_TYPE an error_mark_node, like TREE_TYPE (x) in the case at issue). Thus the additional check I'm suggesting. Tested x86_64-linux.

Thanks,
Paolo.

//////////////////////
/cp
2014-03-19  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/60384
        * name-lookup.c (push_class_level_binding_1): Check identifier_p
        on the name argument.

/testsuite
2014-03-19  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/60384
        * g++.dg/cpp1y/pr60384.C: New.
Index: cp/name-lookup.c
===================================================================
--- cp/name-lookup.c    (revision 208682)
+++ cp/name-lookup.c    (working copy)
@@ -3112,7 +3112,9 @@ push_class_level_binding_1 (tree name, tree x)
   if (!class_binding_level)
     return true;
 
-  if (name == error_mark_node)
+  if (name == error_mark_node
+      /* Can happen for an erroneous declaration (c++/60384).  */
+      || !identifier_p (name))
     return false;
 
   /* Check for invalid member names.  But don't worry about a default
Index: testsuite/g++.dg/cpp1y/pr60384.C
===================================================================
--- testsuite/g++.dg/cpp1y/pr60384.C    (revision 0)
+++ testsuite/g++.dg/cpp1y/pr60384.C    (working copy)
@@ -0,0 +1,9 @@
+// PR c++/60384
+// { dg-do compile { target c++1y } }
+
+template<typename> int foo();
+
+struct A
+{
+  typedef auto foo<>();  // { dg-error "typedef declared 'auto'" }
+};

Reply via email to