diff options
author | Mark Mitchell <mark@codesourcery.com> | 2005-10-10 14:41:52 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2005-10-10 14:41:52 +0000 |
commit | f0d60e22101308e3ed63e42ec33257742cc07380 (patch) | |
tree | cb163c410364b6ab4bc35b3a454234d937f3e087 /gcc | |
parent | e0b923193a67f9a644cfab03fa8a40f0a43b5db3 (diff) | |
download | gcc-f0d60e22101308e3ed63e42ec33257742cc07380.zip gcc-f0d60e22101308e3ed63e42ec33257742cc07380.tar.gz gcc-f0d60e22101308e3ed63e42ec33257742cc07380.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/cp/decl.c | 10 | ||||
-rw-r--r-- | gcc/cp/error.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/spec27.C | 14 |
5 files changed, 45 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4055464..87d5299 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 1bca147..91d76ba 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<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; diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 814250a..1b70bbb 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 b8abbed..fac40d6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 0000000..a31adad --- /dev/null +++ b/gcc/testsuite/g++.dg/template/spec27.C @@ -0,0 +1,14 @@ +// PR c++/24139 + +template<typename T> +struct O { + struct I; +}; + +template<> +struct O<int>::I +{ + I(); +}; + +O<int>::I::I() {} |