C++14 lambda’s default argument type deduction depending on preceding arguments
Is this not valid as C++14?
I was expecting it to be roughly equivalent to
Neither GCC 6.3 nor Clang 4.0 accepted my code.
Is it related to my lack of understanding of C++ template deduction phases? Does the 1400 pages long spec actually has an explicit answer to my question?
To summarize, my problem can in fact be reduced to this piece of code (free of lambda, single parameter) and it is invalid under C++14 (thanks @BaummitAugen and @NirFriedman)
The compilers are correct to reject your code, it is indeed not valid C++14.
In the standard (using N4141 here) we have
(5.1.2/4 [expr.prim.lambda]). So your call is equivalent to a call to some
(14.8.2/4 [temp.deduct.type]) and
(14.8.2/5 [temp.deduct.type]) makes your call ill-formed.