<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Explicit template instantiation can't be combined with specialization"
href="https://bugs.llvm.org/show_bug.cgi?id=39215">39215</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Explicit template instantiation can't be combined with specialization
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>7.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</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>o_kniemeyer@maxon.de
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>As far as I understand the C++17 standard, the code below should compile. I.e.,
it should be possible to give the definition for an explicit template
instantiation declaration by an explicit specialization.
C++17 17.7.2.5 is
"For a given set of template arguments, if an explicit instantiation of a
template appears after a declaration of an explicit specialization for that
template, the explicit instantiation has no effect. Otherwise, for an explicit
instantiation definition the definition of a function template, a variable
template, a member function template, or a member function or static data
member of a class template shall be present in every translation unit in which
it is explicitly instantiated."
GCC and Intel compile the code without errors.
template <typename T> struct S
{
static const char* s;
};
extern template const char* S<void>::s;
template <> const char* S<void>::s = "void";
// the following should have no effect according to standard
// template const char* S<void>::s;</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>