diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4055464a28a..87d52996bf9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,17 @@ +2005-10-10 Mark Mitchell + + 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 PR c++/22172 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 1bca147a774..91d76ba6216 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7551,9 +7551,13 @@ grokdeclarator (const cp_declarator *declarator, is correct; there shouldn't be a `template <>' for the definition of `S::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; diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 814250abb21..1b70bbbb0fb 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -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); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b8abbeda19d..fac40d68119 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2005-10-10 Mark Mitchell + + 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 * 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 index 00000000000..a31adadd3e6 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/spec27.C @@ -0,0 +1,14 @@ +// PR c++/24139 + +template +struct O { + struct I; +}; + +template<> +struct O::I +{ + I(); +}; + +O::I::I() {}