https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109870
Bug ID: 109870 Summary: Miscomputation of return type of unevaluated lambda in type alias in template context Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ed at catmur dot uk Target Milestone: --- template<class> struct X {}; template<class T> struct M { using R = decltype([] { return 1; }()); template<class U> struct S { X<R> p; }; }; M<int>::S<void> s; 9.1 through 14.0.0 trunk reject with: <source>: In instantiation of 'struct M<int>::S<void>': <source>:7:17: required from here <source>:4:36: error: return-statement with a value, in function returning 'void' [-fpermissive] 4 | using R = decltype([] { return 1; }()); | ^ It appears the `U` type parameter in `M<T>::S<U>` is overwriting the lambda deduced return type. Possibly related to #92707, #103569