public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48046] New: [4.5/4.6 Regression] Expected diagnostic "reference to  'type' is ambiguous" not given for function-local static declaration
@ 2011-03-09 14:56 dev.lists at jessamine dot co.uk
  2011-03-09 15:07 ` [Bug c++/48046] " redi at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: dev.lists at jessamine dot co.uk @ 2011-03-09 14:56 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-04-28 15:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-09 14:56 [Bug c++/48046] New: [4.5/4.6 Regression] Expected diagnostic "reference to 'type' is ambiguous" not given for function-local static declaration dev.lists at jessamine dot co.uk
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

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).