Hi,

On 09/15/2015 03:11 AM, Jason Merrill wrote:
On 09/14/2015 06:17 PM, Paolo Carlini wrote:
Hi Florian,

On 09/14/2015 09:41 PM, Florian Weimer wrote:
  This warning is
+enabled by default.
Maybe add a sentence why this is bad?  I can only guess, but I suspect
the reason is this: Such types are necessarily specific to a single
translation unit because any definition in another translation unit
would be an ODR violation, so they can be put into the anonymous
namespace themselves.
As I probably mentioned somewhere, GCC is the only compiler I have at
hand implementing something similar: frankly, I'm not sure how exactly
we want to put it, concisely and neatly at the same time. If you are
willing to prepare something more concrete, I'm sure Jason would be
happy to review it!

Florian's summary is correct.

If a type A depends on a type B with no or internal linkage, defining it in multiple translation units would be an ODR violation because the meaning of B is different in each translation unit. If A only appears in a single translation unit, the best way to silence the warning is to give it internal linkage by putting it in an anonymous namespace as well. The compiler doesn't give this warning for types defined in the main .C file, as those are unlikely to have multiple definitions.
Thanks. Then I guess I'm going to simply add to invoke.texi the above as-is: if somebody thinks it's too long and sees a way to shorten it without loosing important details, please speak asap ;)

Paolo.

Reply via email to