re PR c++/27559 (ICE on templated operator new)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Mon, 15 May 2006 08:58:25 +0000 (08:58 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Mon, 15 May 2006 08:58:25 +0000 (08:58 +0000)
PR c++/27559
* pt.c (push_template_decl_real): Return error_mark_node instead
of broken decl.

* g++.dg/template/new4.C: New test.

From-SVN: r113777

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

index 632c7bbc29a300e5373b84c310f2ea23e0ff548f..739f0e145e17e57a4fd9f165866f4923b6830f24 100644 (file)
@@ -1,5 +1,9 @@
 2006-05-15  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/27559
+       * pt.c (push_template_decl_real): Return error_mark_node instead
+       of broken decl.
+
        PR c++/27496
        * pt.c (tsubst_friend_class): Return early on invalid friend
        declarations.
index 1634d2b932fb0f6ca6006433d38f4b28472b278d..bcf2096576488f639338e842bd8d6fb6bb320f80 100644 (file)
@@ -3009,7 +3009,7 @@ push_template_decl_real (tree decl, bool is_friend)
                 template. ... Template allocation functions shall
                 have two or more parameters.  */
              error ("invalid template declaration of %qD", decl);
-             return decl;
+             return error_mark_node;
            }
        }
       else if (DECL_IMPLICIT_TYPEDEF_P (decl)
index ea7859d31224d6adb91c45368918b74181d44509..c7ef3aeae72ec726a27a0d0c5a6fefcacc11bb38 100644 (file)
@@ -1,5 +1,8 @@
 2006-05-15  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/27559
+       * g++.dg/template/new4.C: New test.
+
        PR c++/27496
        * g++.dg/template/void2.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/template/new4.C b/gcc/testsuite/g++.dg/template/new4.C
new file mode 100644 (file)
index 0000000..bf6f061
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/27559
+// { dg-do compile }
+
+struct A
+{
+    template<typename T>
+    static void* operator new(T) {} // { dg-error "first parameter|invalid template" }
+};