Open
Description
Clang does not appear to be able to deduce that a function that always throws is effectively [[noreturn]], not even in seemingly trivial cases. Consider this:
void throwError(const std::string& msg){
throw std::runtime_error(msg);
}
int ensureZero(const int i){
if (i == 0) return 0;
throwError("ERROR");
}
Compiling with -Wall -Wextra -O3 -std=c++2c
yields a false positive warning:
warning: non-void function does not return a value in all control paths [-Wreturn-type]