]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport:
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Mon, 5 Dec 2005 13:09:17 +0000 (13:09 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Mon, 5 Dec 2005 13:09:17 +0000 (13:09 +0000)
2005-10-13  Mark Mitchell  <mark@codesourcery.com>

PR c++/23307
* pt.c (push_template_decl_real): Complain about attempts to
declare template variables.

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

From-SVN: r108054

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

index 58b445bf8d7c60a550fe7a412a3c14e1968f2098..6a78fa502d3086731506993ef8eb830c204d14db 100644 (file)
@@ -1,3 +1,12 @@
+2005-12-05  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       Backport:
+       2005-10-13  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/23307
+       * pt.c (push_template_decl_real): Complain about attempts to
+       declare template variables.
+
 2005-11-30  Release Manager
 
        * GCC 3.4.5 released.
index 0e4a7b9d3461cb542d25544814448c45c1dc29ab..b547cefbda9a8a3429673f2f5c60ddf185be69d3 100644 (file)
@@ -2837,9 +2837,8 @@ push_template_decl_real (tree decl, int is_friend)
              return decl;
            }
        }
-      else if ((DECL_IMPLICIT_TYPEDEF_P (decl)
-               && CLASS_TYPE_P (TREE_TYPE (decl)))
-              || (TREE_CODE (decl) == VAR_DECL && ctx && CLASS_TYPE_P (ctx)))
+      else if (DECL_IMPLICIT_TYPEDEF_P (decl)
+              && CLASS_TYPE_P (TREE_TYPE (decl)))
        /* OK */;
       else
        {
index b3c6d9755ab5b9fea0ec170b71df595408812fe4..6d38f7e7025f7db1791be31f2ba6cf14bdffeed9 100644 (file)
@@ -1,3 +1,11 @@
+2005-12-05  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       Backport:
+       2005-10-13  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/23307
+       * g++.dg/template/crash38.C: New test.
+
 2005-12-03  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * gcc.c-torture/execute/stdio-opt-1.c,
diff --git a/gcc/testsuite/g++.dg/template/crash38.C b/gcc/testsuite/g++.dg/template/crash38.C
new file mode 100644 (file)
index 0000000..c652cc8
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/23307
+
+class A
+{
+  template<class R>
+  static void f(X&); // { dg-error "" }
+  inline void A::f<void>(X&); // { dg-error "f|expected" }
+};