This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/29365] Unnecessary anonymous namespace warnings
- From: "pinskia at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Aug 2007 22:11:09 -0000
- Subject: [Bug c++/29365] Unnecessary anonymous namespace warnings
- References: <bug-29365-7796@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #37 from pinskia at gmail dot com 2007-08-28 22:11 -------
Subject: Re: Unnecessary anonymous namespace warnings
On 28 Aug 2007 21:41:05 -0000, bangerth at dealii dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
> That's what I thought too at first, but the request is valid anyway as long
> as you never use the pointer to the class from anywhere except the one
> implementation file in which the class is defined.
No it is not, it is still violating One definition rule as struct X
will have a different member type for pimpl_ in each TU (this violates
the whole idea of types being exported). This is going to be true no
matter what, even if you change the warning. Now you can use a
"void*" to get around this issue and should solve the issue and not
violate the C++ ODR.
This warning is not about style, it is about warning when you are most
likely going to violat C++'s One definition rule with anonymous
namespaces and you do violate it here as explained above.
Thanks,
Andrew Pinski
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29365