http://llvm.org/bugs/show_bug.cgi?id=22565
Bug ID: 22565
Summary: static constexpr floating member incorrectly
identified as odr-used
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Given the following code from stackoverflow question
http://stackoverflow.com/q/28264279/1708801 :
struct Blob {
static constexpr double a = 10;
};
int main() {
Blob b;
auto c = b.a;
}
Does not link and produces the following error:
prog.cc:(.text+0xb): undefined reference to `Blob::a' clang: error: linker
command failed with exit code 1 (use -v to see invocation)
Here is a online live version:
http://melpon.org/wandbox/permlink/JRphxTSHekwqEd6p
This looks like an odr-use issue since adding an out of class definition fixes
the issue:
constexpr double Blob::a ;
As far as I can tell a is not odr-used and so this should be valid code without
the out of class definition.
Note, using qualified id to access the member works though:
auto c = Blob::a;
Also, using any level of optimization(-O1 etc...) also makes the problem go
away.
--
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