- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When overriding operator `=` with "default" and "virtual" fails to compile.
Without virtual, it works properly.
Error Message
icpc -std=c++17 sample.cpp ld: /tmp/icpczIU0ix.o:(.rodata._ZTV6Entity[_ZTV6Entity]+0x10): undefined reference to `Entity::operator=(Entity const&)'
Source code
#include <iostream> class Entity { public: Entity() = default; virtual Entity & operator = ( Entity const & )=default; public: int index; }; Entity e1 = Entity(); int main() { std::cout << e1.index; return(0); }
Intel c++ compiler version
icpc (ICC) 19.0.5.281 20190815
gcc (GCC) 9.2.0
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for reporting this issue. I've filed a bug CMPLRIL0-32275 to the Developer.

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