On Friday, September 11th, 2026 at 6:51 PM, Ivan Sokolov via Gcc <[email protected]> wrote:
> On Sat, 12 Sep 00:01:00 GMT 2026, > "Ivan Sokolov" <[email protected]> wrote: > > > The standard [expr.prim.lambda.closure#12] seems silent on the matter, > > and the above examples make me think this paragraph was simply > > forgotten when wording was modified to account for constraints. > > On a second look, it seems Clang and GCC both do another useful > deviation from that the standard. > > The paragraph says that the return value of the conversion operator > should be as if decltype(/*operator() call*/). However, when a trailing > return type is present, as it is in my example, we are able to bypass > the decltype() and use the trailing return type as it is spelled, which > allows us to deduce the template parameter on the conversion even > though it is not deducible on the call operator. > > int(*pfn)() = []<typename T>()->T { return T{}; }; > // clang and gcc both accept this, in spite of the standard > > So perhaps that one paragraph is in need of a bigger overhaul :) > Yes I think you should open a CWG issue. And at minimum open a PR for the ICE in your first message. (Please do check if it is a duplicate first, I haven't done so yet.) Thanks, Alex.
