https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99214
Bug ID: 99214 Summary: Incorrect template arguments shown in constraint satisfaction failure diagnostic Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ppalka at gcc dot gnu.org Target Milestone: --- $ cat testcase.C template <class T> struct A { template <class U> static void f() requires ([] { return U::fail; }()); template <class U> static void f(); }; int main() { A<int>::f<char>(); } $ cat testcase.C | g++-11 -std=c++20 -x c++ - <stdin>: In substitution of ‘template<class U> static void A<int>::f<U>() requires (<lambda>)() [with U = int]’: <stdin>:8:19: required from here <stdin>:3:63: error: ‘fail’ is not a member of ‘char’ In the above diagnostic, the "in substitution of" context line incorrectly shows "U = int" instead of "U = char". GCC 10 shows the correct template arguments: $ cat testcase.C | g++-10 -std=c++20 -x c++ - <stdin>: In instantiation of ‘static void A<T>::f() requires (<lambda>)() [with U = char; T = int]’: <stdin>:8:19: required from here <stdin>:3:63: error: ‘fail’ is not a member of ‘char’