<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54439>54439</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang incorrectly evaluates requires { variable_temp; } in C++20
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
beached
</td>
</tr>
</table>
<pre>
Clang will hard error on the following. It should evaluate has_if_foo<long> to false and compile successfully
https://godbolt.org/z/6EfdTK9eY
```cpp
#include <type_traits>
template <typename T>
inline constexpr bool dependent_false = false;
template <typename T>
inline std::enable_if_t<dependent_false<T>>* is_foo = nullptr;
template <>
inline constexpr bool is_foo<int> = true;
template <typename T>
concept has_is_foo = requires { is_foo<T>; };
static_assert(
has_is_foo<int>
);
static_assert(
not has_is_foo<long>
);```
Error: ```
source>:7:13: note: in instantiation of template type alias 'enable_if_t' requested here
inline std::enable_if_t<dependent_false<T>>* is_foo = nullptr;
^
<source>:13:33: note: in instantiation of variable template specialization 'is_foo' requested here
concept has_is_foo = requires { is_foo<T>; };
^
<source>:13:33: note: in instantiation of requirement here
concept has_is_foo = requires { is_foo<T>; };
^~~~~~~~~
<source>:13:22: note: while substituting template arguments into constraint expression here
concept has_is_foo = requires { is_foo<T>; };
^~~~~~~~~~~~~~~~~~~~~~~
<source>:20:9: note: while checking the satisfaction of concept 'has_is_foo<long>' requested here
not has_is_foo<long>
^~~~~~~~~~~~~~~~
1 error generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy9VktzmzAQ_jVw0dQDyPhx4OBXZzq95tKTR4gF1MoSlURS99d3xSN23DhOmkkZAUZa7e737WrXuS6O2UYyVZEHISWpmSkIGKMN0Yq4GkippdQPQlUTQr44YmvdShS5Z7JlDnCD3YtyX2od0I3UqgrojjhNSiYtEKYKwvWhERKIbTkHa8tWymMQbYNoVTvX2ICuguQzjkoXuZZuok2FX7_xnu3K4u7rEr714sEs6gdvmmEmoUJx2RZA0Lo7NrB3hgmHSneDRPd0cGik93aQUuwA5O5RSCgpFKCjyjr41RiSay1JAShYgHL7HktAtz2qgK7frty6wiOlK1zPJXjOHG64MIIz3U4cyYoI63ntDCtkrXHmBdM30PS6UE4o50PklTrTvhEMKuXQuD7qJ-8M_GyFAUuC-fpkqUeyxsnthRXrmBN8z6wF44Jk0c8SvE6KH10dQ718tRKl3VNFQ14-0TQm07nKnU98jBG5WLW6NRw6OKs53jH1QmgG_FsoHOiNcgI9wmOjS_LIoyeRMCkYkpPMz4OfzDveAKNUkBoMfGS-kLMrSEcm6OYcWYeK3oR2z4zwLp0w2ga4QIy_exlENjB_BeK7s4jcuN6JcHDkgDT_b6_nV8ZVNElyjuah7ittbp1wrcOqfYoSM1XrIVkEjAW6qw9YLBGjrxJYmT36j4b7EsbXj-fYSCJ8LP8mg9fAf3REYDOzGGNbMj5GegSJmfpswbiSwLeLzD_j7XbHQwuuQIHB2BWTiw4YFhktlnTJQoyzhIx3HRx7oTYGuJPHxwZtn0ZsPLx7nxZDxPwZ2ATJGkcSha2R2UVjFq5u8wn2cfyQ8n58fWqM_o7W8FNYiyThj3Q6pcuwzlgCi4iXS06hpGU6j9Mp5YuyyGnKF1MWhZLlIG0WpOsg3YYiS6IkiWi8iKfTZZxOZpCWJWcc8niWzGZxMI3gwISceMP-L0Joss6HvK0sLkphnT0tYlMQlQIY9bPW1dpkOTBMhyLs3M06X_8AhM61rg">