// MSVC headers define two constructors instead of using optional arguments.
basic_string(constC*);
basic_string(constC*,constA&);
~basic_string();
};
typedefbasic_string<char>string;
typedefbasic_string<wchar_t>wstring;
// std::exception and std::runtime_error declaration.
structexception{
exception();
exception(constexception&other);
virtual~exception();
};
structruntime_error:publicexception{
explicitruntime_error(conststd::string&what_arg);
};
}// namespace std
// The usage of this class should never emit a warning.
structRegularClass{};
// Class name contains the substring "exception", in certain cases using this class should emit a warning.
structRegularException{
RegularException(){}
// Constructors with a single argument are treated differently (cxxFunctionalCastExpr).
RegularException(int){}
};
// --------------
voidstdExceptionNotTrownTest(inti){
if(i<0)
// CHECK-MESSAGES: :[[@LINE+1]]:5: warning: suspicious exception object created but not thrown; did you mean 'throw {{.*}}'? [bugprone-throw-keyword-missing]