]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/60384 ([c++1y] ICE with invalid typedef)
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 21 Mar 2014 16:35:26 +0000 (16:35 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 21 Mar 2014 16:35:26 +0000 (16:35 +0000)
/cp
2014-03-21  Paolo Carlini  <paolo.carlini@oracle.com>

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

/testsuite
2014-03-21  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/60384
* g++.dg/cpp1y/pr60384.C: New.

From-SVN: r208752

gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/pr60384.C [new file with mode: 0644]

index 3d043d95f1300393f6cba12251b293019f51b737..1acfec335f642f88ca4ef3ce8ce0b85ee3d37be8 100644 (file)
@@ -1,3 +1,9 @@
+2014-03-21  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/60384
+       * name-lookup.c (push_class_level_binding_1): Check identifier_p
+       on the name argument.
+
 2014-03-20  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/60572
index ea16061f2ae7d510c5cb6294da2dacc5c55d9f8b..53f14f3eee618eca2158cf9a55816f3ec28553a2 100644 (file)
@@ -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)
index a04e2d02896faf16d662bab44a1f59e38bbe03bb..a57529844c8f3e1243628662beb7c0ba8314da73 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-21  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/60384
+       * g++.dg/cpp1y/pr60384.C: New.
+
 2014-03-21  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..f206647
--- /dev/null
@@ -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'" }
+};