<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - thread_local variable declaration treated as definition in direct linkage-specification"
href="http://llvm.org/bugs/show_bug.cgi?id=18839">18839</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>thread_local variable declaration treated as definition in direct linkage-specification
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.4
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>filip.roseen@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=12062" name="attach_12062" title="testcase.cpp">attachment 12062</a> <a href="attachment.cgi?id=12062&action=edit" title="testcase.cpp">[details]</a></span>
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>