https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103760

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Jacek Olczyk from comment #4)
> (In reply to Patrick Palka from comment #2)
> > GCC's behavior appears to be correct here (though perhaps less useful than
> > Clang's).  According to wg21.link/temp.deduct.general#9 a lambda expression
> > isn't part of the immediate context, so substitution failure from within the
> > lambda ought to be a hard error, not a SFINAE error.  Note that Clang also
> > doesn't reject the first four examples from that paragraph.
> 
> Forgive me if I'm wrong (it's my first time reading into the standard), but
> this seems to be from a section explicitly talking about function templates,
> not templates in general - and function templates seem to be somewhat of a
> special case in many ways. I have not, however, been able to find the
> portion of the standard which delves into the relevant behavior in other
> templates.

That's a fair point, it's my understanding that the standard doesn't very
clearly define SFINAE in the first place (e.g. the standard uses but never
defines the term "immediate context", which is an open issue
wg21.link/cwg1844).

But at least in the case, we can also seek guidance from the proposal paper for
unevaluated lambdas, wg21.link/p0315.  At the top of page 7 the paper discusses
using lambdas inside constraints and comes to the same conclusion.

Reply via email to