Project

General

Profile

Feature #687

LLVM clang: warning: 'extern' variable has an initializer

Added by Nikolai Saoukh over 11 years ago. Updated over 11 years ago.

Status:
Rejected
Priority:
Low
Assignee:
-
Category:
-
Start date:
04 Mar 2010
Due date:
% Done:

0%

Estimated time:

Description

All the messages are in the attachment. I am puzzled by 'extern' attribute in this case.


Files

extern-init.txt (58.8 KB) extern-init.txt Nikolai Saoukh, 04 Mar 2010 07:49

History

#1

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
#2

Updated by Nikolai Saoukh over 11 years ago

Yes. I think clang needs one more message kind -- confusion. ;-)

#3

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).

#4

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. ;-(

#5

Updated by Andreas Huggel over 11 years ago

  • Status changed from New to Rejected

Closing this ("won't fix"), see note #3 above.

Also available in: Atom PDF