]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/24139 (Rejects definition of member of specialized inner class)
authorMark Mitchell <mark@codesourcery.com>
Mon, 10 Oct 2005 14:41:52 +0000 (14:41 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Mon, 10 Oct 2005 14:41:52 +0000 (14:41 +0000)
PR c++/24139
* decl.c (grokdeclarator): Do not require template parameter lists
for explicitly specialized class.
* error.c (dump_aggr_type): Do not dump template arguments for
non-primary specializations.
(dump_function_name): Likewise.
PR c++/24139
* g++.dg/template/spec27.C: New test.

From-SVN: r105172

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

index 4055464a28a34f26277dd366a7d5eaa22d0e5949..87d52996bf9580fa5de5e2007443b6a698c53b6c 100644 (file)
@@ -1,3 +1,17 @@
+2005-10-10  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/24139
+       * decl.c (grokdeclarator): Do not require template parameter lists
+       for explicitly specialized class.
+       * error.c (dump_aggr_type): Do not dump template arguments for
+       non-primary specializations.
+       (dump_function_name): Likewise.
+
+       PR c++/24275
+       * pt.c (instantiate_decl): Instantiate the initializer of
+       a static data member in the namespace containing the class
+       containing the static data member.
+
 2005-10-08  James A. Morrison  <phython@gcc.gnu.org>
 
        PR c++/22172
index 1bca147a7742861a64920586998ff5d8c946523f..91d76ba62164509996fe45caed273775806e6c10 100644 (file)
@@ -7551,9 +7551,13 @@ grokdeclarator (const cp_declarator *declarator,
 
             is correct; there shouldn't be a `template <>' for the
             definition of `S<int>::f'.  */
-         if (CLASSTYPE_TEMPLATE_INFO (t)
-             && (CLASSTYPE_TEMPLATE_INSTANTIATION (t)
-                 || uses_template_parms (CLASSTYPE_TI_ARGS (t)))
+         if (CLASSTYPE_TEMPLATE_SPECIALIZATION (t)
+             && !any_dependent_template_arguments_p (CLASSTYPE_TI_ARGS (t)))
+           /* T is an explicit (not partial) specialization.  All
+              containing classes must therefore also be explicitly
+              specialized.  */
+           break;
+         if ((CLASSTYPE_USE_TEMPLATE (t) || CLASSTYPE_IS_TEMPLATE (t))
              && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t)))
            template_count += 1;
 
index 814250abb21e8851c376d987d605a2b1e192f592..1b70bbbb0fb8fb965038963ce286c1ff5a022a63 100644 (file)
@@ -437,9 +437,7 @@ dump_aggr_type (tree t, int flags)
       typdef = !DECL_ARTIFICIAL (name);
       tmplate = !typdef && TREE_CODE (t) != ENUMERAL_TYPE
                && TYPE_LANG_SPECIFIC (t) && CLASSTYPE_TEMPLATE_INFO (t)
-               && (CLASSTYPE_TEMPLATE_SPECIALIZATION (t)
-                   || TREE_CODE (CLASSTYPE_TI_TEMPLATE (t)) != TEMPLATE_DECL
-                   || DECL_TEMPLATE_SPECIALIZATION (CLASSTYPE_TI_TEMPLATE (t))
+               && (TREE_CODE (CLASSTYPE_TI_TEMPLATE (t)) != TEMPLATE_DECL
                    || PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t)));
       dump_scope (CP_DECL_CONTEXT (name), flags | TFF_SCOPE);
       if (tmplate)
@@ -1182,9 +1180,7 @@ dump_function_name (tree t, int flags)
 
   if (DECL_TEMPLATE_INFO (t)
       && !DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t)
-      && (DECL_TEMPLATE_SPECIALIZATION (t)
-         || TREE_CODE (DECL_TI_TEMPLATE (t)) != TEMPLATE_DECL
-         || DECL_TEMPLATE_SPECIALIZATION (DECL_TI_TEMPLATE (t))
+      && (TREE_CODE (DECL_TI_TEMPLATE (t)) != TEMPLATE_DECL
          || PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (t))))
     dump_template_parms (DECL_TEMPLATE_INFO (t), !DECL_USE_TEMPLATE (t), flags);
 }
index b8abbeda19d7a0f3af1adc42a18105cc7eb8455f..fac40d68119f4e3a9f55d2e71af9a94b5a39e415 100644 (file)
@@ -1,3 +1,11 @@
+2005-10-10  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/24139
+       * g++.dg/template/spec27.C: New test. 
+
+       PR c++/24275
+       * g++.dg/template/static19.C: New test.
+
 2005-10-09  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        * gcc.dg/20050922-1.c: Skip on Solaris 2.5.1 to 9.
diff --git a/gcc/testsuite/g++.dg/template/spec27.C b/gcc/testsuite/g++.dg/template/spec27.C
new file mode 100644 (file)
index 0000000..a31adad
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/24139
+
+template<typename T>
+struct O {
+  struct I;
+};
+
+template<>
+struct O<int>::I
+{
+  I();
+};
+
+O<int>::I::I() {}