]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/18586 (ICE on invalid template member declaration)
authorMark Mitchell <mark@codesourcery.com>
Wed, 24 Nov 2004 18:10:26 +0000 (18:10 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 24 Nov 2004 18:10:26 +0000 (18:10 +0000)
PR c++/18586
* parser.c (cp_parser_init_declarator): Do not pop scope twice.

PR c++/18586
* g++.dg/template/crash27.C: New test.

From-SVN: r91182

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

index faf73ad89fd3d28f21be18a1098e951818631466..abfc86abb8a0fbd845b00153a1a172f1fe9c2b1b 100644 (file)
@@ -1,5 +1,8 @@
 2004-11-24  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/18586
+       * parser.c (cp_parser_init_declarator): Do not pop scope twice.
+
        PR c++/18530
        * cp-tree.h (CTOR_NAME): Remove.
        (DTOR_NAME): Remove.
index 265abdb81e42e60b38ce6b38d07d739a3496387c..ccd8a95c434e778bcc517e8d8515835fda0d8df1 100644 (file)
@@ -10590,7 +10590,10 @@ cp_parser_init_declarator (cp_parser* parser,
   if (member_p)
     {
       if (pop_p)
-       pop_scope (scope);
+       {
+         pop_scope (scope);
+         pop_p = false;
+       }
       decl = grokfield (declarator, decl_specifiers,
                        initializer, /*asmspec=*/NULL_TREE,
                        /*attributes=*/NULL_TREE);
index 03014a1ee3f3d4fac495080f11f2f47b9a4a4a02..d569fb719fb9e4b7da95b726b46405ab2fea2b2c 100644 (file)
@@ -1,5 +1,8 @@
 2004-11-24  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/18586
+       * g++.dg/template/crash27.C: New test. 
+
        PR c++/18530
        * g++.dg/warn/Wshadow-3.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/template/deduce3.C b/gcc/testsuite/g++.dg/template/deduce3.C
new file mode 100644 (file)
index 0000000..d6d68a8
--- /dev/null
@@ -0,0 +1,9 @@
+template <typename T>
+void f(int, T (*)() = 0);
+
+void g() {
+  typedef int A[2];
+  f<A>(0); // { dg-error "" }
+  typedef void F();
+  f<F>(0); // { dg-error "" }
+}