public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: Gabriel Dos Reis <gdr@cs.tamu.edu> To: gcc-bugzilla@gcc.gnu.org Cc: gcc-bugs@gcc.gnu.org Subject: Re: [Bug c++/31187] New: [4.2 regression] extern declaration of variable in anonymous namespace prevents use of its address as template argument Date: Fri, 16 Mar 2007 15:15:00 -0000 [thread overview] Message-ID: <87r6rqcwrm.fsf@soliton.cs.tamu.edu> (raw) In-Reply-To: <bug-31187-1827@http.gcc.gnu.org/bugzilla/> "zak at transversal dot com" <gcc-bugzilla@gcc.gnu.org> writes: | The following code, which compiles fine on gcc 4.1.2 and I believe is valid, | fails on an up-to-date checkout from the 4.2 branch: | | -------------------------------------- | class foo { }; | | namespace | { | extern foo foo1; | foo foo1; | } | | template< foo * > | class bar { }; | | bar< &foo1 > bar1; | --------------------------------------- | | giving the error: | | test.cc:12: error: '&<unnamed>::foo1' is not a valid template argument of type | 'foo*' because '<unnamed>::foo1' does not have external linkage | test.cc:12: error: invalid type in declaration before ';' token | | | ... which I would only expect if "foo1" were declared "static". Yes, this is a bug in the compiler. I suspect it was introduced when the the back was told to treat declarations at unnamed namespaces ast static. That of course is an optimization and should be appear at the front-end. -- gaby
next prev parent reply other threads:[~2007-03-16 15:15 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-03-15 14:25 zak at transversal dot com 2007-03-15 16:06 ` [Bug c++/31187] [4.2/4.3 " pinskia at gcc dot gnu dot org 2007-03-15 16:07 ` pinskia at gcc dot gnu dot org 2007-03-16 15:15 ` Gabriel Dos Reis [this message] 2007-03-16 15:15 ` gdr at cs dot tamu dot edu 2007-03-22 23:17 ` mmitchel at gcc dot gnu dot org 2007-03-22 23:34 ` mmitchel at gcc dot gnu dot org 2007-03-23 2:37 ` bangerth at dealii dot org 2007-03-23 2:44 ` mark at codesourcery dot com 2007-03-23 3:03 ` bangerth at dealii dot org 2007-03-27 2:37 ` jason at gcc dot gnu dot org 2007-04-02 17:50 ` jason at gcc dot gnu dot org 2007-04-02 19:12 ` jason at gcc dot gnu dot org 2007-04-09 21:43 ` jason at gcc dot gnu dot org 2007-06-26 11:58 ` jakub at gcc dot gnu dot org
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=87r6rqcwrm.fsf@soliton.cs.tamu.edu \ --to=gdr@cs.tamu.edu \ --cc=gcc-bugs@gcc.gnu.org \ --cc=gcc-bugzilla@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).