[Bug c++/29365] Unnecessary anonymous namespace warnings

pinskia at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Aug 29 08:53:00 GMT 2007



------- Comment #39 from pinskia at gmail dot com  2007-08-29 08:52 -------
Subject: Re:  Unnecessary anonymous namespace warnings

On 29 Aug 2007 03:15:04 -0000, bangerth at dealii dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
> It is a good question in itself whether pimpl_ has a type at all -- it's a
> pointer to an incomplete type in any case :-)

All types in C++ are exported (well except for anonymous namespace
types) including incomplete types.

So the following two TUs are invalid when combined together.
TU1:
extern struct a *b;
TU2:
extern struct c *b;

It does not matter in C++ if it is an incomplete type because the type
is based on the name rather than compatibility rules (like what is
done for C).

So again this warning is correct based on the One definition rule.

Thanks,
Andrew Pinski


-- 


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



More information about the Gcc-bugs mailing list