https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101904
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Not a bug. The call to zzz.foo had to do overload resolution to decide which foo to call. That means both result_of types get instantiated. That means the lambda gets instantiated with an argument of int* as well as with an argument of const int*. Without an explicit return type the body of the lambda is instantiated, which fails the static_assert for the int* case