template<class T> concept True = true;
template<class T, auto C>
concept Satisfies = requires {
C.template operator()<T>();
};
template<class T>
concept A = Satisfies<T, []<True>{}>;
//static_assert(A<int>);
//Satisfies<[]<True>{}> auto r = 42;
A auto s = 42;
Compile with -std=c++20. Clang 15 is OK. Clang 16-or-later ICEs. Oddly enough, the auto r line does not crash; and if you uncomment the static_assert then the auto s line is accepted successfully. That is, Clang can evaluateA<int> just fine, but somehow it crashes trying to matchA auto against int.
This technique — []<True>{} — comes from Ed Catmur's lightning talk "Higher-Order Template Metaprogramming (in C++23)". He screenshots this Clang ICE (along with a GCC ICE) at the end of the talk... but I don't see that he ever reported it upstream, unless https://github.com/llvm/llvm-project/issues/67058 is the same thing.
https://godbolt.org/z/cEaM98W9q
Compile with
-std=c++20
. Clang 15 is OK. Clang 16-or-later ICEs. Oddly enough, theauto r
line does not crash; and if you uncomment thestatic_assert
then theauto s
line is accepted successfully. That is, Clang can evaluateA<int>
just fine, but somehow it crashes trying to matchA auto
againstint
.This technique —
[]<True>{}
— comes from Ed Catmur's lightning talk "Higher-Order Template Metaprogramming (in C++23)". He screenshots this Clang ICE (along with a GCC ICE) at the end of the talk... but I don't see that he ever reported it upstream, unless https://github.com/llvm/llvm-project/issues/67058 is the same thing.Similar to https://github.com/llvm/llvm-project/issues/67058 and https://github.com/llvm/llvm-project/issues/77250 .