public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Martin Sebor <sebor@roguewave.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c++/7308: template specialization in other namespace Date: Fri, 20 Dec 2002 09:16:00 -0000 [thread overview] Message-ID: <20021220171606.15521.qmail@sources.redhat.com> (raw) The following reply was made to PR c++/7308; it has been noted by GNATS. From: Martin Sebor <sebor@roguewave.com> To: gcc-gnats@gcc.gnu.org Cc: Subject: Re: c++/7308: template specialization in other namespace Date: Fri, 20 Dec 2002 10:09:01 -0700 bangerth@dealii.org wrote: > Old Synopsis: template-class member functions / namespace scope resolution in conjunction with template specialization > New Synopsis: template specialization in other namespace > > State-Changed-From-To: open->analyzed > State-Changed-By: bangerth > State-Changed-When: Thu Dec 19 18:38:35 2002 > State-Changed-Why: > Problem 1 you describe is a well-known bug, namely that > gcc does not presently implement two-stage name lookup. > > Problem 2 can be reduced to the following illegal code that > gcc nevertheless compiles: > ---------------------------- > namespace NS_1 { > namespace NS_2 { > template <typename T> struct C { > void foo (); > }; > } > > template <> > void NS_2::C<int>::foo() {} > } > > int main() { > NS_1::NS_2::C<int> c; > } > ------------------------- > Specializations shall be _declared_ in the same namespace > in which the general template is declared, if I understand > correctly, i.e. there is at least a declaration in the inner > namespace missing. The intent of that requirement is to prevent the declaration from changing the name of the explicit specialization by declaring it unqualified in another namespace. The code above is intended to be well-formed. This is what the wording is intended to disallow: namespace NS_1 { template <typename T> struct C { void foo (); }; namespace NS_2 { template <> void C<int>::foo() {} // error } } int main() { NS_1::NS_2::C<int> ci; // error NS_1::C<int> ci; // okay } Regards Martin
next reply other threads:[~2002-12-20 17:16 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-12-20 9:16 Martin Sebor [this message] -- strict thread matches above, loose matches on Subject: below -- 2002-12-19 18:38 bangerth
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20021220171606.15521.qmail@sources.redhat.com \ --to=sebor@roguewave.com \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).