re PR c++/65127 (internal compiler error: tree check: expected tree that contains...
authorJakub Jelinek <jakub@redhat.com>
Tue, 10 Mar 2015 19:10:43 +0000 (20:10 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 10 Mar 2015 19:10:43 +0000 (20:10 +0100)
PR c++/65127
* parser.c (parsing_nsdmi): Don't return true if current_class_ptr
is not a PARM_DECL.

* g++.dg/cpp0x/pr65127.C: New test.

From-SVN: r221332

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr65127.C [new file with mode: 0644]

index 61c0b18e5ea3f6f22f5b2852e52c0e93cfc5bbf8..1202b0fc868e3c4f653ef15f33d83e4613105247 100644 (file)
@@ -1,3 +1,9 @@
+2015-03-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/65127
+       * parser.c (parsing_nsdmi): Don't return true if current_class_ptr
+       is not a PARM_DECL.
+
 2015-03-10  Jason Merrill  <jason@redhat.com>
 
        PR c++/65333
index ad132b1850f2a10509661e3c61a5dbb6e9fb1265..a209ee608fadd89f0bd23c4b1e34ab01e8bc7120 100644 (file)
@@ -18314,7 +18314,9 @@ parsing_nsdmi (void)
 {
   /* We recognize NSDMI context by the context-less 'this' pointer set up
      by the function above.  */
-  if (current_class_ptr && DECL_CONTEXT (current_class_ptr) == NULL_TREE)
+  if (current_class_ptr
+      && TREE_CODE (current_class_ptr) == PARM_DECL
+      && DECL_CONTEXT (current_class_ptr) == NULL_TREE)
     return true;
   return false;
 }
index 4899406f99dedb2ac03025a7c7e8a1112c997920..e0daa10eb9b9113e4dc1e13c64375f7010467f20 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/65127
+       * g++.dg/cpp0x/pr65127.C: New test.
+
 2015-03-10  Jan Hubicka  <hubicka@ucw.cz>
 
        * gcc.dg/ipa/PR64550.c: Update template.
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr65127.C b/gcc/testsuite/g++.dg/cpp0x/pr65127.C
new file mode 100644 (file)
index 0000000..2cdb8ee
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/65127
+// { dg-do compile { target c++11 } }
+
+template <int N>
+void
+foo ()
+{
+  static int i {100};
+  struct { int id {i++}; } j;
+}
+
+int
+main ()
+{
+  foo<0> ();
+}