#include <iostream>
#include <stdexcept>
using namespace std;
class CustomException : public exception
{
string Reason;
public:
CustomException(const char* why) : Reason(why) {}
virtual const char* what() const
{
return Reason.c_str();
}
};
int main() {
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RkZXhjZXB0Pgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY2xhc3MgQ3VzdG9tRXhjZXB0aW9uIDogcHVibGljIGV4Y2VwdGlvbgp7CglzdHJpbmcgUmVhc29uOwpwdWJsaWM6CglDdXN0b21FeGNlcHRpb24oY29uc3QgY2hhciogd2h5KSA6IFJlYXNvbih3aHkpIHt9CgkKCXZpcnR1YWwgY29uc3QgY2hhciogd2hhdCgpIGNvbnN0Cgl7CgkJcmV0dXJuIFJlYXNvbi5jX3N0cigpOwoJfQp9OwoKaW50IG1haW4oKSB7CglyZXR1cm4gMDsKfQ==
prog.cpp:11:22: error: looser throw specifier for ‘virtual const char* CustomException::what() const’
virtual const char* what() const
^~~~
In file included from /usr/include/c++/6/ios:39:0,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from prog.cpp:1:
/usr/include/c++/6/exception:71:5: error: overriding ‘virtual const char* std::exception::what() const noexcept’
what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT;
^~~~