From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30906 invoked by alias); 9 Mar 2011 14:56:18 -0000 Received: (qmail 30897 invoked by uid 22791); 9 Mar 2011 14:56:17 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 Mar 2011 14:56:11 +0000 From: "dev.lists at jessamine dot co.uk" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dev.lists at jessamine dot co.uk X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Date: Wed, 09 Mar 2011 14:56:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-03/txt/msg00877.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D48046 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: : In function 'int main()': :9: error: reference to 'T' is ambiguous :2: error: candidates are: typedef float N2::T :1: error: typedef int N1::T :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) outp= ut: : In function =E2=80=98int main()=E2=80=99: :9:14: error: =E2=80=98T=E2=80=99 does not name a type If the static declaration and preceding using directives are moved to names= pace scope rather than being function-local, the expected diagnostic is output. If the function-local declaration is made non-static, the expected diagnost= ic is output.