diff options
author | Mark Mitchell <mark@codesourcery.com> | 2004-06-14 15:58:54 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2004-06-14 15:58:54 +0000 |
commit | 7c82a41e7f18796040b3e6effbf6c483b7beb915 (patch) | |
tree | 3899c5cea0f22109ff80c76fd4ccd139aedf8dd4 /gcc/cp | |
parent | f3207b37d34107210fda3f7b3bc999ac7537d7c0 (diff) | |
download | gcc-7c82a41e7f18796040b3e6effbf6c483b7beb915.zip gcc-7c82a41e7f18796040b3e6effbf6c483b7beb915.tar.gz gcc-7c82a41e7f18796040b3e6effbf6c483b7beb915.tar.bz2 |
re PR c++/15096 (parse error with templates and pointer to const member)
PR c++/15096
* decl.c (grokdeclarator): Ignore pointer-to-members when
computing template depth.
PR c++/14930
* name-lookup.c (pushtag): Do not try to put class declarations in
explicit specialization scopes.
PR c++/15096
* g++.dg/template/ptrmem10.C: New test.
PR c++/14930
* g++.dg/template/friend30.C: New test.
From-SVN: r83112
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cp/decl.c | 37 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 11 |
3 files changed, 39 insertions, 19 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cb18209..d99aef0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2004-06-14 Mark Mitchell <mark@codesourcery.com> + + PR c++/15096 + * decl.c (grokdeclarator): Ignore pointer-to-members when + computing template depth. + + PR c++/14930 + * name-lookup.c (pushtag): Do not try to put class declarations in + explicit specialization scopes. + 2004-06-11 Andrew Pinski <pinskia@physics.uc.edu> * decl.c (grokdeclarator): Do not depend on C99's _Bool's behavior. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 950bac1..417171e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7599,27 +7599,28 @@ grokdeclarator (tree declarator, ctype = TREE_OPERAND (declarator, 0); t = ctype; - while (t != NULL_TREE && CLASS_TYPE_P (t)) - { - /* You're supposed to have one `template <...>' - for every template class, but you don't need one - for a full specialization. For example: - + if (TREE_CODE (TREE_OPERAND (declarator, 1)) != INDIRECT_REF) + while (t != NULL_TREE && CLASS_TYPE_P (t)) + { + /* You're supposed to have one `template <...>' + for every template class, but you don't need one + for a full specialization. For example: + template <class T> struct S{}; template <> struct S<int> { void f(); }; void S<int>::f () {} - - 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))) - && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t))) - template_count += 1; - - t = TYPE_MAIN_DECL (t); - t = DECL_CONTEXT (t); - } + + 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))) + && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t))) + template_count += 1; + + t = TYPE_MAIN_DECL (t); + t = DECL_CONTEXT (t); + } if (sname == NULL_TREE) goto done_scoping; diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index d470251..3e42f3b 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -4635,7 +4635,16 @@ pushtag (tree name, tree type, int globalize) timevar_push (TV_NAME_LOOKUP); b = current_binding_level; - while (b->kind == sk_cleanup + while (/* Cleanup scopes are not scopes from the point of view of + the language. */ + b->kind == sk_cleanup + /* Neither are the scopes used to hold template parameters + for an explicit specialization. For an ordinary template + declaration, these scopes are not scopes from the point of + view of the language -- but we need a place to stash + things that will go in the containing namespace when the + template is instantiated. */ + || (b->kind == sk_template_parms && b->explicit_spec_p) || (b->kind == sk_class && (globalize /* We may be defining a new type in the initializer |