[llvm-bugs] [Bug 39215] New: Explicit template instantiation can't be combined with specialization
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Oct 8 02:22:08 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39215
Bug ID: 39215
Summary: Explicit template instantiation can't be combined with
specialization
Product: clang
Version: 7.0
Hardware: PC
OS: MacOS X
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: o_kniemeyer at maxon.de
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
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;
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181008/c60311c2/attachment.html>
More information about the llvm-bugs
mailing list