#include <iostream>
class MathException : std:: exception
{
public :
MathException( std:: string && whatStr) noexcept : whatStr( std:: move ( whatStr) ) { }
MathException( const std:: string & whatStr) noexcept : whatStr( whatStr) { }
~MathException( ) noexcept;
const char * what( ) const noexcept override;
private :
std:: string whatStr;
} ;
const char * MathException:: what ( ) const noexcept
{
return whatStr.c_str ( ) ;
}
int main( )
try
{
true ? throw MathException( "Parse Error" ) : 1 ;
}
catch ( ...)
{
}
I2luY2x1ZGUgPGlvc3RyZWFtPgogCmNsYXNzIE1hdGhFeGNlcHRpb24gOiBzdGQ6OmV4Y2VwdGlvbgp7CnB1YmxpYzoKICAgIE1hdGhFeGNlcHRpb24oc3RkOjpzdHJpbmcgJiZ3aGF0U3RyKSBub2V4Y2VwdCA6IHdoYXRTdHIoc3RkOjptb3ZlKHdoYXRTdHIpKSB7IH0KICAgIE1hdGhFeGNlcHRpb24oY29uc3Qgc3RkOjpzdHJpbmcgJndoYXRTdHIpIG5vZXhjZXB0IDogd2hhdFN0cih3aGF0U3RyKSB7IH0KICAgIH5NYXRoRXhjZXB0aW9uKCkgbm9leGNlcHQ7CiAKICAgIGNvbnN0IGNoYXIqIHdoYXQoKSBjb25zdCBub2V4Y2VwdCBvdmVycmlkZTsKIApwcml2YXRlOgogICAgc3RkOjpzdHJpbmcgd2hhdFN0cjsKfTsKIApjb25zdCBjaGFyKiBNYXRoRXhjZXB0aW9uOjp3aGF0KCkgY29uc3Qgbm9leGNlcHQKewogICAgcmV0dXJuIHdoYXRTdHIuY19zdHIoKTsKfQogCmludCBtYWluKCkKdHJ5CnsKCXRydWUgPyB0aHJvdyBNYXRoRXhjZXB0aW9uKCJQYXJzZSBFcnJvciIpIDogMTsJCn0KY2F0Y2goLi4uKQp7CiAKfQ==
compilation info
/home/7NhO2E/ccLwHgxD.o: In function `main':
prog.cpp:(.text.startup+0x39): undefined reference to `vtable for MathException'
prog.cpp:(.text.startup+0x3e): undefined reference to `MathException::~MathException()'
prog.cpp:(.text.startup+0x43): undefined reference to `typeinfo for MathException'
collect2: error: ld returned 1 exit status
stdout