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

    <tr>
        <th>Summary</th>
        <td>
            [Clang][C++]  It is not possible to initialize constants using the 'constexpr' static member of a function reference parameter
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    ```cpp
struct A {
  constexpr static int value = 0;
};

void func(A& _) {
 constexpr auto result = _.value;
}

auto main() -> int {
  A a;
  func(a);
}
```

#### error message:

```txt
<source>:6:18: error: constexpr variable 'result' must be initialized by a constant expression
    6 |   constexpr auto result = _.value;
      |                  ^ ~~~~~~~
<source>:6:27: note: function parameter '_' with unknown value cannot be used in a constant expression
    6 |   constexpr auto result = _.value;
      |                           ^
<source>:5:14: note: declared here
    5 | void func(A& _) {
      | ^
```

#### Additional Information:

Version: clang version 18.1.8
Link: [godbolt](https://godbolt.org/z/xYWfx48sT)

PS: The code compiles successfully on gcc and msvc.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VE2P4zYM_TX0hZjAkb8PPngmE2CBPSzQRYueBrLMJOrKUiDK2Zk99LcXsvO1gy0GvVQQHEUmH_meSUpmvbdELRSPUGwSOYWD8-0XZ6T_rO0gy6R3w1sLZbpsdTxCuoG04-AnFbBDqB6XG0TlLAd6PXrkIINWqG3AkzQTIWQbTCE7m0K1uZ3n58npAXeTVSDqDkSJLyCaO-wbtJyCQ088mTCjvqzmCD9h3wHP5qPUFkQdIR8ge57zusu7Q3l1x0sWEkTzC9CLEPcxQGTXjeS98zgSs9wTZN1Phhfv8BrON9kTu8krguwZsq6ErFvXkHULTDzcmJ-k17I3hCCqRQAQFY4TB-wJtdVBS6N_0ID9G8rFUdqA0ZmYtbMXioglQvWE-B90xXktXu8WFM_497L-lZWoIhnrQtRk1jhoZ_EovRwpkI-kXiKf7zoccLLfrPtuz8WjpLVuJjkxDajt_8runuYv6RXxo-X39AZSRnoa8ECebgGKOcBHpX7N5Bbvw6LrhkFHPaXBT3bn_Cjjv3fV9zt5Xm5RGWn3eFoucF2v1qt6Mfqs7bdoAcXj3g29MwGKDYj6EMKRI6DYgtieX62c34PY_gCxff3zj91rXvPX2DZ3Qb_8FtG-HgiVG-JjPGpDjDwpRcy7yZg3dBb3SqG0A458UqvFNRnabGiyRibUritR5Pm6qcvk0O5EXg-ykXWj6rwsKtXUqugVqVyqdLfOE92KVORpk-ZpI0pRrrKiV3U5qKbsmzwnCXlKo9RmZcxpjCwSzTxRu04rkWaJkT0ZnoeiELNWIEScj76NDg_9tGfIU6M58A0i6GDmSfo0exSbeATxGHexQfwUUHOsETw6Zh07Obi7vr3WNOPE2u4xHOZev1ZxbI_zZB1p7Mmj26G8NZOnHXmyim5tlUzetO--nQ6HqV8pN4LYxuTPPw9H7_4iFUBsZzEYxPasx6kV_wQAAP__Sj_NuA">