Open
Description
The following should be valid C++20 code:
template <class T>
using F = decltype([] (auto a) requires (sizeof(T) > sizeof a) {});
int main() {
F<int> f;
f(char{});
}
Clang rejects with:
<source>:6:5: error: no matching function for call to object of type 'F<int>' (aka '(lambda at <source>:2:20)')
6 | f(char{});
| ^
<source>:2:20: note: candidate template ignored: constraints not satisfied [with a:auto = char]
2 | using F = decltype([] (auto a) requires (sizeof(T) > sizeof a) {});
| ^
<source>:2:42: note: because 'sizeof(char) > sizeof a' (1 > 1) evaluated to false
2 | using F = decltype([] (auto a) requires (sizeof(T) > sizeof a) {});
| ^
Somehow it got char
substituted into T
in sizeof(T)
?