http://llvm.org/bugs/show_bug.cgi?id=5905
Richard Smith <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED CC| |[email protected] Resolution|--- |INVALID --- Comment #5 from Richard Smith <[email protected]> --- The original code here is actually valid. Per C++ 3.5/8, "a type without linkage shall not be used as the type of a variable [...] with external linkage unless [...] the entity is not odr-used or is defined in the same translation unit". In this case, the variable satisfies *both* of these criteria. If we write: union { int x; float y; } extern anon; // not defined in this TU int main() { return anon.x; // odr-used in this TU } ... then clang issues a diagnostic: <stdin>:4:10: warning: variable '<anonymous namespace>::anon' has internal linkage but is not defined [-Wundefined-internal] } extern anon; ^ <stdin>:7:10: note: used here return anon.x; ^ This still isn't quite right: we claim that 'anon' has internal linkage, but it actually should have external linkage, and -pedantic-errors doesn't promote this diagnostic to an error, but it's enough to be conforming. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ LLVMbugs mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs
