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

* [Bug c++/48046] [4.5/4.6 Regression] Expected diagnostic "reference to  'type' is ambiguous" not given for function-local static declaration
  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 ` redi at gcc dot gnu.org
  2011-03-09 18:19 ` jason at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-09 15:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48046

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.03.09 15:06:48
     Ever Confirmed|0                           |1


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

* [Bug c++/48046] [4.5/4.6 Regression] Expected diagnostic "reference to  'type' is ambiguous" not given for function-local static declaration
  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
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2011-03-09 18:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48046

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-03-09 18:19:37 UTC ---
Looking.


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

* [Bug c++/48046] [4.5/4.6 Regression] Expected diagnostic "reference to  'type' is ambiguous" not given for function-local static declaration
  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
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2011-03-09 18:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48046

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
                 CC|                            |paolo.carlini at oracle dot
                   |                            |com
         AssignedTo|jason at gcc dot gnu.org    |unassigned at gcc dot
                   |                            |gnu.org

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-03-09 18:28:53 UTC ---
This was broken by the fix for bug 35112.  Any thoughts, Paolo?


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

* [Bug c++/48046] [4.5/4.6 Regression] Expected diagnostic "reference to  'type' is ambiguous" not given for function-local static declaration
  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
                   ` (2 preceding siblings ...)
  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
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-03-09 18:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48046

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-03-09 18:39:23 UTC ---
Gosh, not really at the moment, quite a bit of time ago. Looks like, the whole
point of my changes was avoiding duplicate error messages, thus, worst case we
can re-instantiate the old logic, seems a better compromise?


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

* [Bug c++/48046] [4.5/4.6/4.7 Regression] Expected diagnostic "reference to  'type' is ambiguous" not given for function-local static declaration
  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
                   ` (3 preceding siblings ...)
  2011-03-09 18:39 ` paolo.carlini at oracle dot com
@ 2011-03-14 14:27 ` rguenth at gcc dot gnu.org
  2011-03-17  0:22 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-03-14 14:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48046

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.5.3


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

* [Bug c++/48046] [4.5/4.6/4.7 Regression] Expected diagnostic "reference to  'type' is ambiguous" not given for function-local static declaration
  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
                   ` (4 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-03-17  0:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48046

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
                 CC|                            |jakub at gcc dot gnu.org


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

* [Bug c++/48046] [4.5/4.6/4.7 Regression] Expected diagnostic "reference to  'type' is ambiguous" not given for function-local static declaration
  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
                   ` (5 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2011-04-27 15:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48046

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2011-04-27 15:56:50 UTC ---
Author: jason
Date: Wed Apr 27 15:56:46 2011
New Revision: 173036

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173036
Log:
    PR c++/48046
    * parser.c (cp_parser_diagnose_invalid_type_name): Commit
    to tentative parse sooner.

Added:
    trunk/gcc/testsuite/g++.dg/parse/ambig6.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/48046] [4.5/4.6/4.7 Regression] Expected diagnostic "reference to  'type' is ambiguous" not given for function-local static declaration
  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
                   ` (6 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2011-04-27 15:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48046

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2011-04-27 15:57:11 UTC ---
Author: jason
Date: Wed Apr 27 15:57:06 2011
New Revision: 173038

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173038
Log:
    PR c++/48046
    * parser.c (cp_parser_diagnose_invalid_type_name): Commit
    to tentative parse sooner.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/parse/ambig6.C
Modified:
    branches/gcc-4_6-branch/gcc/cp/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/parser.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug c++/48046] [4.5 Regression] Expected diagnostic "reference to  'type' is ambiguous" not given for function-local static declaration
  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
                   ` (7 preceding siblings ...)
  2011-04-27 15:58 ` jason at gcc dot gnu.org
@ 2011-04-27 16:01 ` jason at gcc dot gnu.org
  2011-04-27 16:01 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2011-04-27 16:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48046

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |
            Summary|[4.5/4.6/4.7 Regression]    |[4.5 Regression] Expected
                   |Expected diagnostic         |diagnostic "reference to
                   |"reference to  'type' is    |'type' is ambiguous" not
                   |ambiguous" not given for    |given for function-local
                   |function-local static       |static declaration
                   |declaration                 |

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2011-04-27 15:58:07 UTC ---
Fixed in 4.6/4.7.  Waiting for 4.5 to unfreeze before applying there.


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

* [Bug c++/48046] [4.5 Regression] Expected diagnostic "reference to  'type' is ambiguous" not given for function-local static declaration
  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
                   ` (8 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-04-27 16:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48046

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-04-27 15:59:01 UTC ---
Thanks Jason.


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

* [Bug c++/48046] [4.5 Regression] Expected diagnostic "reference to  'type' is ambiguous" not given for function-local static declaration
  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
                   ` (9 preceding siblings ...)
  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
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-04-28 14:53 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48046

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.5.3                       |4.5.4

--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-04-28 14:50:59 UTC ---
GCC 4.5.3 is being released, adjusting target milestone.


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

* [Bug c++/48046] [4.5 Regression] Expected diagnostic "reference to  'type' is ambiguous" not given for function-local static declaration
  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
                   ` (10 preceding siblings ...)
  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
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2011-04-28 15:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48046

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> 2011-04-28 15:03:03 UTC ---
Fixed for 4.5.4.


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

* [Bug c++/48046] [4.5 Regression] Expected diagnostic "reference to  'type' is ambiguous" not given for function-local static declaration
  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
                   ` (11 preceding siblings ...)
  2011-04-28 15:51 ` jason at gcc dot gnu.org
@ 2011-04-28 15:52 ` jason at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2011-04-28 15:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48046

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2011-04-28 15:02:19 UTC ---
Author: jason
Date: Thu Apr 28 15:02:17 2011
New Revision: 173116

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173116
Log:
    PR c++/48046
    * parser.c (cp_parser_diagnose_invalid_type_name): Commit
    to tentative parse sooner.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/parse/ambig6.C
Modified:
    branches/gcc-4_5-branch/gcc/cp/ChangeLog
    branches/gcc-4_5-branch/gcc/cp/parser.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog


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