Feature #687
LLVM clang: warning: 'extern' variable has an initializer
0%
Description
All the messages are in the attachment. I am puzzled by 'extern' attribute in this case.
Files
History
Updated by Andreas Huggel over 11 years ago
Does the following code, taken from the C++ Standard ISO/IEC 14882:2003(E), section 3.1 Declarations and definitions, also produce a warning?
extern const int c = 1; // defines c
Updated by Nikolai Saoukh over 11 years ago
Yes. I think clang needs one more message kind -- confusion. ;-)
Updated by Andreas Huggel over 11 years ago
So maybe the warning is just intended to ask the developer whether he really meant what he wrote.
For the cases highlighted here, the answer is yes, these arrays specifically need to have external linkage so that they work with the pretty-print template magic (and it's nice that I can write all in one statement, without a need for a separate declaration).
Updated by Nikolai Saoukh over 11 years ago
So that is why it just 'warning', not 'error'. Unfortunately there is no switch to suppress that warning in current clang. ;-(
Updated by Andreas Huggel over 11 years ago
- Status changed from New to Rejected
Closing this ("won't fix"), see note #3 above.