<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 --- - Specialization differs from the template declaration with respect to the constexpr specifier"
href="https://llvm.org/bugs/show_bug.cgi?id=25704">25704</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Specialization differs from the template declaration with respect to the constexpr specifier
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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++14
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tom.smart.bishop@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>In the following sample the specialization for the constructor vec<float,
__m128> differs from the template declaration vec<T, STORE> with respect to the
constexpr specifier.
#include "xmmintrin.h"
template<typename T, typename STORE>
struct alignas(16) vec {
union {
STORE st;
struct { T x; T y; T z; T w; };
};
inline explicit constexpr vec() noexcept :
x{0}, y{0}, z{0}, w{0} {
}
};
template<>
inline vec<float, __m128>::vec() noexcept :
st{_mm_setzero_ps()} {
}
When reading the standard (not sure if this is the correct source though)
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4567.pdf">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4567.pdf</a> there is a
note in "7.1.5 The constexpr specifier" that says:
[ Note: An explicit specialization can differ from the template declaration
with respect to the constexpr specifier. — end note ]
However in clang 3.7 I get the following error "non-constexpr declaration of
'vec' follows constexpr declaration" with the sample code.
(gcc 5.1 compiles)</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>