https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97402
Bug ID: 97402 Summary: Value of dependent partial-concept-id is not usable in a constant expression Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ed at catmur dot uk Target Milestone: --- #include <concepts> template<class T> void f(T x) { std::same_as<T> auto y = x; } int main() { f(1); } In file included from <source>:1: <source>: In instantiation of 'void f(T) [with T = int]': <source>:5:17: required from here .../gcc-trunk-20201013/include/c++/11.0.0/concepts:57:15: required for the satisfaction of '__same_as<_Tp, _Up>' [with _Tp = int; _Up = T] .../gcc-trunk-20201013/include/c++/11.0.0/concepts:57:32: error: the value of 'std::is_same_v<int, T>' is not usable in a constant expression 57 | concept __same_as = std::is_same_v<_Tp, _Up>; | ~~~~~^~~~~~~~~~~~~~~~~~~ In file included from .../gcc-trunk-20201013/include/c++/11.0.0/concepts:44, from <source>:1: .../gcc-trunk-20201013/include/c++/11.0.0/type_traits:3220:25: note: 'std::is_same_v<int, T>' used in its own initializer 3220 | inline constexpr bool is_same_v = __is_same(_Tp, _Up); | ^~~~~~~~~ <source>:3:26: error: deduced initializer does not satisfy placeholder constraints 3 | std::same_as<T> auto y = x; | ^ <source>:3:26: note: constraints not satisfied https://godbolt.org/z/qGT5xe Changing std::same_as<T> to std::same_as<int> makes it compile OK. Feels a little like 96410.