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

    <tr>
        <th>Summary</th>
        <td>
            [Clang18][Concepts] Using static data member as concept argument in partially specialized template fails to compile
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    The following example compiles with Clang 17 but not in Clang 18 (since approximately 1 week):

```
template<typename T, typename U, int i>
concept True = true;

template<typename T, int I>
struct Template
{
 static constexpr int i = I;

    friend constexpr auto operator+(True<T, i> auto f)
    {
        return i;
 }
};

template<int I>
struct Template<float, I>
{
 static constexpr int i = I;

    friend constexpr auto operator+(True<float, i> auto f)
    {
        return i;
 }
};

Template<void, 4> f{};

static_assert(+Template<float, 5>{} == 5);
```
With `-std=c++20` on clang 18 I get:

`<source>:9:45: error: no member 'i' in 'Template<float, 5>'; it has not yet been instantiated`

The error is caused in the static_assert. What's interesting is that it's refering to line 9, which is not the specialization `Template<float, 5>`.
The error goes away if I remove the variable `f`, when I don't have a partial specialization, or I use `I` directly.
This is a problem when I don't want to just use the value of `I` but the result of a complex expression dependent on `I` and that result is repeatedly used throughout the specialization, not just 1 function.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VcFy4jgQ_Rpx6RrKlg2GA4cBJlXcMzXHrbbdxpqRJZfUDmG_fqtlILPZZG-7qRQgqfX6vSe1GmM0Z0e0U6u9Wh0XOHHvw-4XmqELaBa1b6-7556g89b6i3FnoFccRkvQ-GE0liJcDPdwsOjOkFdQTwzOMxh3n9uA0ptoXEOA4xj8qxmQyV4hhwvRL6W3qviqsqPK7p_r7PafhkzDaJFJFQe-juRwIHhW-gCP0XcZGcdgVPFt3tR419DI8BwmAlUcgcNEqtj_nudTYIE6PaAih6lhe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