cxxopts icon indicating copy to clipboard operation
cxxopts copied to clipboard

Exception when calling xxx.as<T>()...

Open FredM67 opened this issue 2 years ago • 2 comments

I've a project under MSVC 2017. If CXXOPTS_NO_RTTI is not defined, any call to xxx.as<T>() produce an exception.

Exception occurs at line 1458 of cxxopts.hpp, deeper at line 291 of rtti.cpp.

Unhandled exception at 0x00007FFAB6D24FD9 in bla.exe: Microsoft C++ exception: std::__non_rtti_object at memory location 0x000000FEE92FE820.

FredM67 avatar Oct 13 '22 10:10 FredM67

I'll take a look.

jarro2783 avatar Oct 18 '22 20:10 jarro2783

It looks like you need to also define CXXOPTS_NO_EXCEPTIONS, CXXOPTS_NO_RTTI only turns off dynamic vs static casting. I'm not sure if there is any benefit having those separated, I might just combine them into one option.

jarro2783 avatar Oct 25 '22 19:10 jarro2783