public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "zeratul976 at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/53184] Unnecessary anonymous namespace warnings
Date: Sun, 16 Jun 2013 02:59:00 -0000 [thread overview]
Message-ID: <bug-53184-4-Vq8f0q26Ov@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53184-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53184
--- Comment #6 from Nathan Ridge <zeratul976 at hotmail dot com> ---
(In reply to Jason Merrill from comment #4)
> (In reply to comment #3)
> > Because then the anonymous class has the name "Foo" for linkage purposes, and
> > has external linkage. When Foo referes to the const or volatile qualified form
> > of the class, the anonymous class itself has no name and so no linkage, only
> > the cv-qualified form has a name for linkage purposes.
> >
> > I'm not sure if that behaviour is correct though, let's ask Jason
>
> Yes, that's right. 7.1.3:
>
> If the typedef declaration defines an unnamed class (or enum), the first
> typedef-name declared by the declaration to be that class type (or enum
> type) is used to denote the class type (or enum type) for linkage purposes
> only (3.5).
>
> typedef struct { } *ps, S; // S is the class name for linkage purposes
>
> Adding volatile means that Foo doesn't name the class, it names the volatile
> variant of the class, so it isn't the class's name for linkage purposes, so
> the class has no linkage. The warning complains about using a type with no
> linkage as a member type in a header file, since including that header in
> multiple source files would be an ODR violation as the type Foo is different
> in each translation unit.
Is this ODR violation an actual problem in practice, with GCC? I find these
warnings annoying to work around, and I wouldn't mind seeing an option to
silence them if they don't indicate an actual problem.
next prev parent reply other threads:[~2013-06-16 2:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-02 6:09 [Bug c++/53184] New: " orgads at gmail dot com
2012-05-02 6:26 ` [Bug c++/53184] " pinskia at gcc dot gnu.org
2012-05-02 6:56 ` orgads at gmail dot com
2012-05-02 10:48 ` redi at gcc dot gnu.org
2012-05-02 17:23 ` jason at gcc dot gnu.org
2013-06-15 18:16 ` paolo.carlini at oracle dot com
2013-06-16 2:59 ` zeratul976 at hotmail dot com [this message]
2013-06-17 12:41 ` redi at gcc dot gnu.org
2013-06-17 12:43 ` paolo.carlini at oracle dot com
2013-06-17 12:58 ` paolo.carlini at oracle dot com
2015-04-27 19:45 ` paolo.carlini at oracle dot com
2015-08-19 14:44 ` paolo.carlini at oracle dot com
2015-09-09 16:48 ` paolo at gcc dot gnu.org
2015-09-09 16:53 ` paolo.carlini at oracle dot com
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-53184-4-Vq8f0q26Ov@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: link
Be 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).