In template function, g++ compiler does not detect missing return statement:
This part of code causes the problem: #include <iostream> template <typename P1> int testFunc(P1 p) { } int main() { float f = 0; std::cout << testFunc(f) << std::endl; } g++ command line: $ g++ test.cpp (no output) Test execution: $./a.out 1094713344 G++ version: $ g++ --version g++ (GCC) 4.0.0 20060507 (prerelease) (Debian 4.0.3-3) -- Summary: Missing return statement in template function don't cause compiler error Product: gcc Version: 4.0.4 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: doomtr666 at hotmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28424