re PR c++/8929 (G++ accepts invalid template headers in member definitions of explici...
authorGiovanni Bajo <giovannibajo@gcc.gnu.org>
Wed, 24 Nov 2004 10:40:16 +0000 (10:40 +0000)
committerGiovanni Bajo <giovannibajo@gcc.gnu.org>
Wed, 24 Nov 2004 10:40:16 +0000 (10:40 +0000)
PR c++/8929
* decl.c (start_decl): Check for invalid specialization headers.

PR c++/8929
* g++.old-deja/g++.oliva/template10.C: Remove xfail.

From-SVN: r91145

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.oliva/template10.C

index 4f9c1d89bf49e792adb90653b3ee6968ce1786a4..8797df9d516e61fba890de2e559dc37904a7999c 100644 (file)
@@ -1,3 +1,8 @@
+2004-11-24  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
+
+       PR c++/8929
+       * decl.c (start_decl): Check for invalid specialization headers.
+
 2004-11-24  Paolo Bonzini  <bonzini@gnu.org>
 
        PR c++/16882
index 9baedb42d32cdcd7ce40299a0167524e320a1c71..bca328846e555e630bdb012abe3a051c51a35acd 100644 (file)
@@ -3776,6 +3776,11 @@ start_decl (const cp_declarator *declarator,
                             context, DECL_NAME (decl));
                  DECL_CONTEXT (decl) = DECL_CONTEXT (field);
                }
+             if (processing_specialization
+                 && template_class_depth (context) == 0
+                 && CLASSTYPE_TEMPLATE_SPECIALIZATION (context))
+               error ("template header not allowed in member definition "
+                      "of explicitly specialized class");
              /* Static data member are tricky; an in-class initialization
                 still doesn't provide a definition, so the in-class
                 declaration will have DECL_EXTERNAL set, but will have an
index 8edf27cbee08023a9d2c09df5d182ed5ae9338f5..6a98976fcf6c7e3ea80af6eaf1154e5fcab94df0 100644 (file)
@@ -1,3 +1,8 @@
+2004-11-24  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
+
+       PR c++/8929
+       * g++.old-deja/g++.oliva/template10.C: Remove xfail.
+
 2004-11-24  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        * gcc.target/sparc/align.c: Do not include <stdint.h>.
index 6991bf9c5ddfb824c65a39654b2ad17f61227b3f..5c1204bddcf9aaecc0ed885f7533cf512e9d2612 100644 (file)
@@ -19,4 +19,4 @@ template<> struct A<int> {
 };
 
 bool A<int>::a = true; // ok
-template<> bool A<int>::b = false; // { dg-error "" "" { xfail *-*-* } } 
+template<> bool A<int>::b = false; // { dg-error "template header" }