OSDN Git Service

PR c++/18586
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 24 Nov 2004 18:10:26 +0000 (18:10 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 24 Nov 2004 18:10:26 +0000 (18:10 +0000)
* parser.c (cp_parser_init_declarator): Do not pop scope twice.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91182 138bc75d-0d04-0410-961f-82ee72b054a4

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

index faf73ad..abfc86a 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 265abdb..ccd8a95 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 03014a1..d569fb7 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 "" }
+}