public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dev.lists at jessamine dot co.uk" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/48046] New: [4.5/4.6 Regression] Expected diagnostic "reference to 'type' is ambiguous" not given for function-local static declaration Date: Wed, 09 Mar 2011 14:56:00 -0000 [thread overview] Message-ID: <bug-48046-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48046 Summary: [4.5/4.6 Regression] Expected diagnostic "reference to 'type' is ambiguous" not given for function-local static declaration Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: dev.lists@jessamine.co.uk In g++ 4.5 and 4.6, a function-local static declared with an ambiguous type does not yield the expected diagnostic. It appropriately fails to compile due to a type not being resolved but doesn't give the user the root cause of the failure as it did in 4.4. Given the following code: namespace N1 { typedef int T; } namespace N2 { typedef float T; } int main() { using namespace N1; using namespace N2; static T t; } 4.4.5 outputs: <stdin>: In function 'int main()': <stdin>:9: error: reference to 'T' is ambiguous <stdin>:2: error: candidates are: typedef float N2::T <stdin>:1: error: typedef int N1::T <stdin>:9: error: 'T' does not name a type Both 4.5.0 (an old build I had lying around) and 4.6.0 (at rev 170646) output: <stdin>: In function ‘int main()’: <stdin>:9:14: error: ‘T’ does not name a type If the static declaration and preceding using directives are moved to namespace scope rather than being function-local, the expected diagnostic is output. If the function-local declaration is made non-static, the expected diagnostic is output.
next reply other threads:[~2011-03-09 14:56 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-03-09 14:56 dev.lists at jessamine dot co.uk [this message] 2011-03-09 15:07 ` [Bug c++/48046] " redi at gcc dot gnu.org 2011-03-09 18:19 ` jason at gcc dot gnu.org 2011-03-09 18:29 ` jason at gcc dot gnu.org 2011-03-09 18:39 ` paolo.carlini at oracle dot com 2011-03-14 14:27 ` [Bug c++/48046] [4.5/4.6/4.7 " rguenth at gcc dot gnu.org 2011-03-17 0:22 ` jakub at gcc dot gnu.org 2011-04-27 15:57 ` jason at gcc dot gnu.org 2011-04-27 15:58 ` jason at gcc dot gnu.org 2011-04-27 16:01 ` [Bug c++/48046] [4.5 " jason at gcc dot gnu.org 2011-04-27 16:01 ` paolo.carlini at oracle dot com 2011-04-28 14:53 ` rguenth at gcc dot gnu.org 2011-04-28 15:51 ` jason at gcc dot gnu.org 2011-04-28 15:52 ` jason at gcc dot gnu.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=bug-48046-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).