I\'ve been writing code, and I\'ve recently found out that g++ doesn\'t warn me about a certain class of issue: per C++11 5.1.2.4, if your lambda is not a single return stat
GCC 4.8.1 (and possibly earlier) and clang 3.3 already implements it; fixing DR975.
There is now a proposal (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3386.html) to get it into C++1y
That is because it is a defect in the standard, and will be changed (see DR 975):
975 Restrictions on return type deduction for lambdas
There does not appear to be any technical difficulty that would require the current restriction that the return type of a lambda can be deduced only if the body of the lambda consists of a single return statement. In particular, multiple return statements could be permitted if they all return the same type.
I doubt if there is a way to turn it off.