- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone, I recently came across a linking error when using explicit template instantiation of a non-pure virtual class (see code below).
// TemplateVirtualClass.hpp #pragma once template <class T> class TemplateVirtualClass { public: TemplateVirtualClass() = default; TemplateVirtualClass(const TemplateVirtualClass& x) = default; TemplateVirtualClass(TemplateVirtualClass&& x) = default; virtual ~TemplateVirtualClass() = default; TemplateVirtualClass& operator=(const TemplateVirtualClass& x) = default; TemplateVirtualClass& operator=(TemplateVirtualClass&& x) = default; }; extern template class TemplateVirtualClass<int>; // TemplateVirtualClass.cpp #include "TemplateVirtualClass.hpp" template class TemplateVirtualClass<int>; // main.cpp #include "TemplateVirtualClass.hpp" int main(int argc, char** argv) { TemplateVirtualClass<int> tvc; return 0; }
When compiling with icpc 19 I have this error message:
icpcptdjtl.o:(.data._ZTV20TemplateVirtualClassIiE[_ZTV20TemplateVirtualClassIiE]+0x18): undefined reference to `TemplateVirtualClass<int>::~TemplateVirtualClass()'
Do you have any idea why ? It compiles with g++-7.
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looks like a compiler bug. Let's look into it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Viet Hoang (Intel) wrote:Looks like a compiler bug. Let's look into it.
Hi, any news on this issue ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've reported this back to our Engineer, but it hasn't been addressed. The internal number is CMPLRIL0-32191, fyi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great thank you !

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page