BIV BIV - 6 months ago 42
C++ Question

force c++ compiler to check returning value

In this example will be called deconstructor of nonexisting object. G++ version 5.3, compiling with -Werror .

vector<vector<float>> segfault()


int main()
return 0;


Both gcc and clang have the option -Wreturn-type.
It is turned on implicitly when using -Wall.
To make ensue it is a compiler error, use -Werror=return-type.