http://llvm.org/bugs/show_bug.cgi?id=20825
Bug ID: 20825
Summary: "extern template" seems to invoke explicit
instanciation but it should prohibit it.
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Created attachment 12967
--> http://llvm.org/bugs/attachment.cgi?id=12967&action=edit
A simple test case to illustrate the problem.
If I understood N1448 of the C++11 standard correctly, then "extern template"
should inhibit (implicite) instansiation. However, diagnostics now tell me that
explicit instantiation is actually invoked, inhibiting to partially specialize
static member variables.
The test case given below issues the following disgnostics with
Debian clang version 3.5.0-+rc1-2 (tags/RELEASE_35/rc1) (based on LLVM 3.5.0)
==============
testcase.cc:12:34: error: explicit specialization of 'info' after instantiation
template <> const char * A<int>::info = "This is int";
^
testcase.cc:9:23: note: explicit instantiation first required here
extern template class A<int>;
^
testcase.cc:13:35: error: explicit specialization of 'info' after instantiation
template <> const char * A<char>::info = "This is char";
^
testcase.cc:10:23: note: explicit instantiation first required here
extern template class A<char>;
^
2 errors generated.
=============
g++ (4.9) compiles and links this code fine.
In the code that made me aware of the problem the "extern template" is of
course located in a header file, and hence the specialization can not be added
before the "extern template" because it results in multiple definitions at link
time. On the other hand, using "extern template" is required to enforce
visibility attributes.
Many thanks.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs