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

    <tr>
        <th>Summary</th>
        <td>
            [clang] rejects-valid: 
        </td>
    </tr>

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

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

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

<pre>
    While investigating a potential GCC bug, I went through https://eel.is/c++draft/expr.const#9 which contains the following (reduced) example:

```
struct Swim {
  constexpr int phelps() { return 28; }
};

void splash(Swim& swam) {
  static_assert(swam.phelps() == 28);           // OK
}
```

clang trunk incorrectly rejects this with:

```
<source>:6:17: error: static assertion expression is not an integral constant expression
    6 |   static_assert(swam.phelps() == 28);           // OK
      | ^~~~~~~~~~~~~~~~~~~
<source>:6:17: note: function parameter 'swam' with unknown value cannot be used in a constant expression
<source>:5:19: note: declared here
    5 | void splash(Swim& swam) {
      | ^
```

GCC accepts it.

https://godbolt.org/z/s1vTK7G3h
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyslE_P4yYQxj_N-DLayIH438GHN8lmVe2hh1bqscIwsekSsGCc7PbQz17h5NWb3bbbHmpFDmCYH88DMyolO3qiHqo9VMdCLTyF2HulrsUQzJf-l8k6QuuvlNiOiq0fUeEcmDxb5fDD4YDDMoI44A94I8_IUwzLOOHEPCeQLyBOIE5EbmMTiJMGsQexN1GdOY9_nuNGB58YhOzwNlk9oQ6elfUJeSI8B-fCLXNBtJHMosmA6JA-q8vsKBPKI5Sv77p8_NZu4rhoxp9u9oLQ7O-DiCswo9F6xnkiNycQbQ4LzR4j8RI9ihbkHqE5PkI3R5D7Z9g1WINpdipNINoMAVFjuqnLI9IrL7Fiq39VKVFkEG2esvkaK48gj7h2MvXtufuHP35828XfKb2_tVN-RI6L_4TW6xAjaXZfMNJvpDkbahPeLE_ftw3kIYUlagL5HuRLDfJl24B8QYoxxNy4K8K7Ihs8Zjcppdy0CX1gVD67S2NU7m648vw07dUbxBqhOeD_6tJjsDkgVO__-MvzLyp94Hyv8Lx4vYqbVVQXYooIormfb7PaiIv_5MPN41W5hVArn5UPhEsig9aj-mfp3-CrjO-e8Ya0U5EMThTpTVe16vrPd-_JiO9cnJzHSmuaOaHlzfOnrxN5DGYIjjchjiBOv4M4pe3154_NBzkVppemk50qqN82YteJsqrqYupp2J2rYai2u115Vk3TtsrU3VbIStRl1ZrC9qIUu7IVXdnKqqo3jSYj6saYczeIXSdhV9JFWbdx7nrJ7MKmtFC_Leuq7AqnBnJpLWJCrDkAQuR6Fvu84N2wjAl2pbOJ01sItuzWyndfUR1f0-TdVTlr8hEUS3T9NwZYnpZho8MFxCnHevy9m2PIq0Gc1r3lYvfY3rUXfwYAAP__O-OeBA">