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

    <tr>
        <th>Summary</th>
        <td>
            Constraint satisfaction claims to depend on itself when it shouldn't
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang,
            clang:frontend
      </td>
    </tr>

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

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

<pre>
    **Code**

```cpp
template <class _From, class _To>
constexpr bool is_convertible_v = __is_convertible(_From, _To);
template <class...> class tuple;
template <class T0> struct tuple<T0> {
  template <class U0>
    requires __is_constructible(U0, 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:6:14: error: satisfaction of constraint '__is_constructible(U0, U0)' depends on itself
 6 |     requires __is_constructible(U0, U0)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
file.cpp:6:14: note: while substituting template arguments into constraint expression here
    6 |     requires __is_constructible(U0, U0)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
file.cpp:6:14: note: while checking constraint satisfaction for template 'tuple<int>' required here
    6 |     requires __is_constructible(U0, U0)
      | ^~~~~~~~~~~~~~~~~~
file.cpp:6:14: note: while substituting deduced template arguments into function template 'tuple' [with U0 = tuple<int>]
file.cpp:6:14: note: while substituting template arguments into constraint expression here
    6 |     requires __is_constructible(U0, U0)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
file.cpp:6:14: note: while checking constraint satisfaction for template 'tuple<int>' required here
    6 |     requires __is_constructible(U0, U0)
      | ^~~~~~~~~~~~~~~~~~
file.cpp:6:14: note: in instantiation of function template specialization 'tuple<int>::tuple<tuple<int>>' requested here
file.cpp:6:14: note: while substituting template arguments into constraint expression here
    6 |     requires __is_constructible(U0, U0)
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
file.cpp:2:62: note: while checking constraint satisfaction for template 'tuple<ConvertibleFrom>' required here
    2 | constexpr bool is_convertible_v = __is_convertible(_From, _To);
      | ^
file.cpp:2:62: note: in instantiation of function template specialization 'tuple<ConvertibleFrom>::tuple<tuple<int>>' requested here
file.cpp:10:15: note: in instantiation of variable template specialization 'is_convertible_v<tuple<int>, tuple<ConvertibleFrom>>' requested here
 10 | static_assert(is_convertible_v<tuple<int>, tuple<ConvertibleFrom>>);
 |               ^
```

**Discussion**

While I suspect that this is a bug in the constraint satisfaction, I'm not 100% certain. It might also be a diagnostic communication issue, because I don't see how checking `__is_constructible(U0, U0)` can end up as `__is_constructible(tuple<int>, tuple<int>)` in this case.

Given that the code here is a reduction of #81333's code, this may be the underlying bug.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsV01zIjcQ_TXi0rWUkBgGDhwwmNTedytHSiM1jDYaiag1djaH_PaUZvgwxtjJrpNKUplyCY0-uvv1e9K0FZHdecQ5K-5YsRqoNtUhzvUXUw2qYL7OmVgwsVgGg32P8RXjx3bC-z-93_cjCZu9UwmByaV2igg26xgaJpZweP0UmLzvF-vgKeEv-whVCA4sbXTwDxiTrRxuHoDJFWw2l8NMTE8Wsy0xY_Luhu_hcMjk_cFxavcOb6-FTzyvpRRbnY6Ll_0gKw-7AK73feYnPAAAEX9ubUQ6Bd5bPIT-mee4czs7Wexc9VNnLKxcnfqHmJbnJHQJOE-rZPVGEWFMTEyfp5HJ5RGO9SkHK5YngFdG77sFTwI5UnzB-0ETTaO8AWf9a9o4cO2U3zFxx8QdfKBkmFzp_lVw2FqHw5OGXnG5smrnAyWr33R4sikXEyYXozGTC8AYQ8wdUsnSVulkg4ewhZ4oZX0CJso3uRMlGNyjNwTBg02EbnsgdAKsXMI3SSE_eTMr7n-79bwCzoeE-fextg6B2oqSTW2yfneWrYq7tkGfCKxP4SnsfA6RKOejxojnmP4p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