https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96443
Bug ID: 96443 Summary: Incorrect satisfaction value for dependent return type placeholder constraint 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: --- GCC 10.1, 10.2 and 11 fail to accept the following valid testcase. Satisfaction checking of f's return type placeholder constraint seems to go wrong at some point. $ cat testcase.C template<typename T, typename U> concept Same = __is_same(T, U); auto f(auto x) -> Same<decltype(x)> auto { return 0; } int a = f(42); $ g++ -std=c++2a testcase.C testcase.C: In instantiation of ‘auto [requires ::Same<<placeholder>, decltype(f::x)>] f(auto:1) [with auto:1 = int]’: testcase.C:7:13: required from here testcase.C:6:51: error: deduced return type does not satisfy placeholder constraints 6 | auto f(auto x) -> Same<decltype(x)> auto { return 0; } | ^ testcase.C:6:51: note: constraints not satisfied testcase.C: In instantiation of ‘auto [requires ::Same<<placeholder>, decltype(g::x)>] g(auto:2) [with auto:2 = bool]’: testcase.C:10:15: required from here testcase.C:9:51: error: deduced return type does not satisfy placeholder constraints 9 | auto g(auto x) -> Same<decltype(x)> auto { return 0; } // { dg-error "constraint" } | ^ testcase.C:9:51: note: constraints not satisfied testcase.C:4:9: required for the satisfaction of ‘Same<int, decltype (x)>’ testcase.C:4:16: note: ‘int’ is not the same as ‘bool’ 4 | concept Same = __is_same(T, U); | ^~~~~~~~~~~~~~~