Undefined typeinfo reference for decltype (nullptr)

I tried to compile a simple code int main() { throw nullptr; }

and got the error:

/tmp/main-ea26ec.o: In function `main':
main.cpp:(.text+0x13): undefined reference to `typeinfo for decltype(nullptr)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

      

Command line: clang++ -std=gnu++1z -stdlib=libc++ -Ofast -march=native -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-newline-eof main.cpp -o a && ./a

. Clang ++ version clang version 3.6.0 (tags/RELEASE_360/final 235480)

(from coliru ).

I am going through related questions and having problems with functions virtual

, but the type is std::nullptr_t

not a class and has no member functions.

What is the source of the error?

I also tried adding auto const & unused = typeid(std::nullptr_t);

to create a syntax like info for nullptr

(is this wrong?) But it gives nothing.

+3


source to share





All Articles