public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33858]  New: Spurious warning with anonymous namespace
@ 2007-10-22 13:17 jm at bourguet dot org
  2007-10-30 18:23 ` [Bug c++/33858] " ralgith at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jm at bourguet dot org @ 2007-10-22 13:17 UTC (permalink / raw)
  To: gcc-bugs

g++ -Wall -Wextra on

namespace {
enum { bar, quux } baz;
}

gives as warning:

testwarn.cpp:2: warning: non-local variable '<unnamed>::<anonymous enum>
<unnamed>::baz' uses anonymous type

I don't thing that variables in anonymous namespace should be considered as non
local for the purpose of this warning.


-- 
           Summary: Spurious warning with anonymous namespace
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jm at bourguet dot org


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


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

* [Bug c++/33858] Spurious warning with anonymous namespace
  2007-10-22 13:17 [Bug c++/33858] New: Spurious warning with anonymous namespace jm at bourguet dot org
@ 2007-10-30 18:23 ` ralgith at gmail dot com
  2007-12-02 22:24 ` [Bug c++/33858] Spurious warning with anonymous namespace and anonymous types pinskia at gcc dot gnu dot org
  2009-05-08 18:54 ` tobi at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: ralgith at gmail dot com @ 2007-10-30 18:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ralgith at gmail dot com  2007-10-30 18:23 -------
Or be considered non-local, but NOT generate the warning. This is a fairly
common coding convention, and this warning keeps jumping up and down at me in
several programs I've compiled.


-- 

ralgith at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ralgith at gmail dot com


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


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

* [Bug c++/33858] Spurious warning with anonymous namespace and anonymous types
  2007-10-22 13:17 [Bug c++/33858] New: Spurious warning with anonymous namespace jm at bourguet dot org
  2007-10-30 18:23 ` [Bug c++/33858] " ralgith at gmail dot com
@ 2007-12-02 22:24 ` pinskia at gcc dot gnu dot org
  2009-05-08 18:54 ` tobi at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-12-02 22:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-12-02 22:24 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2007-12-02 22:24:33
               date|                            |
            Summary|Spurious warning with       |Spurious warning with
                   |anonymous namespace         |anonymous namespace and
                   |                            |anonymous types


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


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

* [Bug c++/33858] Spurious warning with anonymous namespace and anonymous types
  2007-10-22 13:17 [Bug c++/33858] New: Spurious warning with anonymous namespace jm at bourguet dot org
  2007-10-30 18:23 ` [Bug c++/33858] " ralgith at gmail dot com
  2007-12-02 22:24 ` [Bug c++/33858] Spurious warning with anonymous namespace and anonymous types pinskia at gcc dot gnu dot org
@ 2009-05-08 18:54 ` tobi at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: tobi at gcc dot gnu dot org @ 2009-05-08 18:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from tobi at gcc dot gnu dot org  2009-05-08 18:53 -------
Note that the C-like equivalent doesn't warn (at least with g++ 4.1.2):
$ cat user/t.cc
namespace {
  struct {
  } t;
}

static struct {
} s;
$ g++ -c user/t.cc
user/t.cc:3: warning: non-local variable '<unnamed>::<anonymous struct>
<unnamed>::t' uses anonymous type
$


-- 

tobi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tobi at gcc dot gnu dot org
   Last reconfirmed|2007-12-02 22:24:33         |2009-05-08 18:53:49
               date|                            |


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


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

end of thread, other threads:[~2009-05-08 18:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-22 13:17 [Bug c++/33858] New: Spurious warning with anonymous namespace jm at bourguet dot org
2007-10-30 18:23 ` [Bug c++/33858] " ralgith at gmail dot com
2007-12-02 22:24 ` [Bug c++/33858] Spurious warning with anonymous namespace and anonymous types pinskia at gcc dot gnu dot org
2009-05-08 18:54 ` tobi at gcc dot gnu dot 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).