auto err = std::string{"exceptions are disabled with -fno-exceptions - attempted to throw exception with type \"" + typeid(decltype(x)).name() + "\""};
if (msg) {
err += " and the message \"" + msg + "\"";
}
type_safety.report_violation( err );
std::terminate();
#else
throwCPP2_FORWARD(x);
#endif
}
inlineautoUncaught_exceptions() -> int {
#ifdef CPP2_NO_EXCEPTIONS
return0;
#else
returnstd::uncaught_exceptions();
#endif
}
template<typename T>
autoDynamic_cast( [[maybe_unused]]auto&& x ) -> decltype(auto) {
#ifdef CPP2_NO_RTTI
type_safety.report_violation( "'as' dynamic casting is disabled with -fno-rtti" );
returnnullptr;
#else
returndynamic_cast<T>(CPP2_FORWARD(x));
#endif
}
template<typename T>
autoTypeid() -> decltype(auto) {
#ifdef CPP2_NO_RTTI
type_safety.report_violation( "'any' dynamic casting is disabled with -fno-rtti" );
#else
returntypeid(T);
#endif
}
autoTypeid( [[maybe_unused]]auto&& x ) -> decltype(auto) {
#ifdef CPP2_NO_RTTI
type_safety.report_violation( "'typeid' is disabled with -fno-rtti" );
static_assert( cpp2::impl::dependent_false<Obj>::value, "error: implicit discard of an object's modified value is not allowed - this function call modifies 'obj', but 'obj' is never used again in the function so the new value is never used - if that's what you intended, add another line '_ = obj;' afterward to explicitly discard the new value of the object" ); \
static_assert( cpp2::impl::dependent_false<Obj>::value, "error: implicit discard of an object's modified value is not allowed - this function call modifies 'obj', but 'obj' is never used again in the function so the new value is never used - if that's what you intended, add another line '_ = obj;' afterward to explicitly discard the new value of the object" ); \
static_assert( cpp2::impl::dependent_false<Obj>::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);', but both failed - if this function call is passing a local variable that will be modified by the function, but that variable is never used again in the function so the new value is never used, that's likely the problem - if that's what you intended, add another line '_ = obj;' afterward to explicitly discard the new value of the object" ); \