<html>
<head>
<base href="https://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 --- - [ms] clang-cl doesn't reject a selectany program that cl rejects"
href="https://llvm.org/bugs/show_bug.cgi?id=23245">23245</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[ms] clang-cl doesn't reject a selectany program that cl rejects
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nicolasweber@gmx.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>This is rejected by cl but not by clang-cl:
template<typename T> struct C {
__declspec(selectany) static int a;
};
int f() {
C<int> c;
return c.a;
}
D:\src\llvm-ninja-rel64>cl foo.cc
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
foo.cc
foo.cc(7) : error C2496: 'C<T>::a' : 'selectany' can only be applied to data
items with external linkage
foo.cc(8) : see reference to class template instantiation 'C<T>' being
compiled
foo.cc(7) : error C2496: 'C<int>::a' : 'selectany' can only be applied to data
items with external linkage
foo.cc(10) : see reference to class template instantiation 'C<int>'
being compiled
We should reject it too.</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>