[LLVMbugs] [Bug 20854] New: Template instantiation fails with undefined reference
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Sep 5 04:45:31 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=20854
Bug ID: 20854
Summary: Template instantiation fails with undefined reference
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: wpoely86 at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 12992
--> http://llvm.org/bugs/attachment.cgi?id=12992&action=edit
The example that fails
I've make a small piece of code (see attachment) that compiles fine with GCC
4.9.1 and icpc-2015.0.090 but not with Clang-3.5.
I've split up the definition and declaration of a template class in the usual
way: in the cpp file, all templates used have been explicitly Instantiation.
If you put everything in the header, everything works fine.
Clang fails with undefined reference to the template class. If I look at the
symbols in the object file generated by Clang and GCC:
GCC:
0000000000000000 W BlockStructure<Matrix>::BlockStructure(int)
0000000000000000 W BlockStructure<Matrix>::BlockStructure(int)
0000000000000000 n _ZN14BlockStructureI6MatrixEC5Ei
0000000000000000 W BlockStructure<Matrix>::~BlockStructure()
0000000000000000 W BlockStructure<Matrix>::~BlockStructure()
0000000000000000 W BlockStructure<Matrix>::~BlockStructure()
0000000000000000 n _ZN14BlockStructureI6MatrixED5Ev
0000000000000000 V typeinfo for BlockStructure<Matrix>
0000000000000000 V typeinfo name for BlockStructure<Matrix>
0000000000000000 V vtable for BlockStructure<Matrix>
U vtable for __cxxabiv1::__class_type_info
U operator delete(void*)
Clang:
0000000000000000 r GCC_except_table1
U _Unwind_Resume
0000000000000000 W BlockStructure<Matrix>::~BlockStructure()
0000000000000000 W BlockStructure<Matrix>::~BlockStructure()
0000000000000000 V typeinfo for BlockStructure<Matrix>
0000000000000000 V typeinfo name for BlockStructure<Matrix>
0000000000000000 V vtable for BlockStructure<Matrix>
U vtable for __cxxabiv1::__class_type_info
U operator delete(void*)
U __gxx_personality_v0
It seems like Clang skips the instantiation of the templates with expecting of
the destructor?
--
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/20140905/95afc901/attachment.html>
More information about the llvm-bugs
mailing list