re PR c++/24139 (Rejects definition of member of specialized inner class)

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
This commit is contained in:
Mark Mitchell 2005-10-10 14:41:52 +00:00 committed by Mark Mitchell
parent e0b923193a
commit f0d60e2210
5 changed files with 45 additions and 9 deletions

View 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

View 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;

View 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);
}

View 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.

View File

@ -0,0 +1,14 @@
// PR c++/24139
template<typename T>
struct O {
struct I;
};
template<>
struct O<int>::I
{
I();
};
O<int>::I::I() {}