<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/81333>81333</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang rejects constant expression in requires-clause as 'non-constant expression'
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang,
            clang:frontend,
            rejects-valid,
            concepts
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          cjdb
      </td>
    </tr>
</table>

<pre>
    **Code**

```cpp
template <int __v> struct integral_constant {
  static const int value = __v;
};
template <class _From, class _To>
constexpr bool is_convertible_v = __is_convertible(_From, _To);
template <class _Tp>
constexpr bool is_copy_constructible_v = __is_constructible(_Tp, _Tp);
template <class...> class tuple;
template <class T0> struct tuple<T0> {
  template <class U0>
    requires is_copy_constructible_v<U0>
  tuple(U0);
};
struct ConvertibleFrom;
static_assert(is_convertible_v<tuple<int>, tuple<ConvertibleFrom>>);
```

**Command line**

```
clang++ -std=c++20 file.cpp
```

**Diagnostic**

```
file.cpp:11:14: error: substitution into constraint expression resulted in a non-constant expression
   11 |     requires is_copy_constructible_v<U0>
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
file.cpp:7:42: note: while checking constraint satisfaction for template 'tuple<int>' required here
    7 | constexpr bool is_copy_constructible_v = __is_constructible(_Tp, _Tp);
 | ^~~~~~~~~~~~~~~~~~
file.cpp:7:42: note: in instantiation of function template specialization 'tuple<int>::tuple<tuple<int>>' requested here
file.cpp:11:14: note: in instantiation of variable template specialization 'is_copy_constructible_v<tuple<int>>' requested here
   11 |     requires is_copy_constructible_v<U0>
      | ^
file.cpp:11:14: note: while substituting template arguments into constraint expression here
   11 |     requires is_copy_constructible_v<U0>
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
file.cpp:5:62: note: while checking constraint satisfaction for template 'tuple<ConvertibleFrom>' required here
    5 | constexpr bool is_convertible_v = __is_convertible(_From, _To);
      | ^
file.cpp:5:62: note: in instantiation of function template specialization 'tuple<ConvertibleFrom>::tuple<tuple<int>>' requested here
file.cpp:15:15: note: in instantiation of variable template specialization 'is_convertible_v<tuple<int>, tuple<ConvertibleFrom>>' requested here
 15 | static_assert(is_convertible_v<tuple<int>, tuple<ConvertibleFrom>>);
 |               ^
file.cpp:11:14: note: initializer of 'is_copy_constructible_v<tuple<int>>' is unknown
   11 |     requires is_copy_constructible_v<U0>
      |              ^
file.cpp:7:16: note: declared here
    7 | constexpr bool is_copy_constructible_v = __is_constructible(_Tp, _Tp);
      |                ^
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8V81yozoTfRqxUdkFkjH2ggXB8RNk1i4h2lgzssQnCc83d3Gf_ZYAA4ltJnOTXMrFj3769OnuI8nMWlEpgBTFTyjeBaxxJ21S_r0sgkKXv1JEMkSyXJfQvaFwh8LrfR12P17XXYuDcy2ZA4xoLpTDh8MF0WdsnWm4w0I5qAyTB66VdUw5jJKnbiLG1jEnOG67_Eh8YbLxhnadlX4gSnbD-xSNS2YtPuyNPiOS4_7zRSP63A1uDcP_a4MLrSUW1ntxAeNEIeFw6YFeNyOyGSx6W2Q7h_1Sz4LVvzrePhR3MMcOj_pSd5j1LOZyufTh7fBdU0uY8e8lnKSiH5x3jZM03M77Fg60MMbYwP8aYcA-IoVo_mpGh0Q238IplWkae5fyMe5tzMduXxgHZi0Yh8jmbeYQza9shHIemeQDvxujz-2AiSPXGn5V2H3Rn89MlVgKNVf8fcYlUxUiT4g84YV1JaI73n2SEB-FhOUgkhnInWCV0tYJ_lvAwSbNosjfVohmGIzRxr_YprBOuMYJrbycdKcsw7y0fGWCtb7LgG2kgxILhRlWWi0GcY6jhuxHEUZJjv9NHfjLz0Xx898PrxtqCaLZinhCSjvwz58nIQHzE_AfQlVTVpY5YY-Mt5SP2kxqmSRvSyS5EijxCQyMXiatl18j4IcBeAdv4dPYJkawlqE-4mOjOrYDU1sDF0y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