Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

Throwing an implicit move-only class leads to linker error.

$
0
0

Intel Compiler 19.4.

The following code compiles cleanly on MSVC and GCC:

#include
#include

struct MyClass{
std::unique_ptr<:string> node;
};

int main(){
throw MyClass();
}

But when compiled with ICC 19.4, it leads to:

1>Main.obj : : error LNK2001: unresolved external symbol "public: __cdecl MyClass::MyClass(struct MyClass const &)" (??0MyClass@@QEAA@AEBU0@@Z)
1>C:\Users\Kotori\Desktop\Test Project\x64\Release\Test Project.exe : : error LNK1120: 1 unresolved externals

It looks like the compiler is trying to call the implicitly deleted copy-constructor instead of the move-constructor.


Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>