http://llvm.org/bugs/show_bug.cgi?id=18839
Bug ID: 18839
Summary: thread_local variable declaration treated as
definition in direct linkage-specification
Product: clang
Version: 3.4
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Created attachment 12062
--> http://llvm.org/bugs/attachment.cgi?id=12062&action=edit
testcase.cpp
main.cpp:
--------------------------------------------------------------------------------
extern "C++" thread_local int x;
int main () {
x = 123;
}
clang++ -pthread -Wall -pedantic -std=c++11 main.cpp
--------------------------------------------------------------------------------
<SUCCESS>
================================================================================
The standard states that a declaration directly contained in a
linkage-specification shall be treated as being declared as `extern`.
We should (with the above in mind) get a linker-error saying that `x` is
undefined within `main` but clang happily compiles our snippet.
gcc issues the correct diagnostic.
[dcl.link] /7
> A declaration directly contained in a linkage-specification is
> treated as if it contains the extern specifier (7.11) for the
> purpose of determining the linkage of the declared namd and
> whether it is a definition. Such declaration shall not specify a
> storage class.
--
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