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

    <tr>
        <th>Summary</th>
        <td>
            Call to consteval function in member initializer cause compilation error
        </td>
    </tr>

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

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

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

<pre>
    If consteval function called in method initializer and this class used in both consteval and not consteval functions, compilation fails with 
```
<source>:4:17: error: cannot take address of consteval function 'baz' outside of an immediate invocation
 int mSize = baz();
```

```
consteval int baz() { return 0;}

struct S {
    int mSize = baz();
};

consteval void bar() {
    S s;
}

void foo() {
    S s;
}
```

This bug is present in 16.x.x and >=18.0.0. (https://godbolt.org/z/o6EnWvvW7)

Issue was introduced in https://github.com/llvm/llvm-project/commit/ca619613801233ef2def8c3cc7d311d5ed0033cb
After it was fixed in https://github.com/llvm/llvm-project/commit/467688527017efb611b09c0cbf92f2d3ecdd1724
And happens again after https://github.com/llvm/llvm-project/commit/baf6bd303bd58a521809d456dd9b179636982fc5

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyklF1vrDYQhn-N92bUlT8AwwUXJHtWOtepdK79MV7cgr2yzSbNr69M0iY5ihS1R0JiEDPvM-MXRuXsLwFxJO0daU8HtZU5ptH5EFcMBx3tX-N3ByaGXPCmFnBbMMXHAEYtC1rwAVYsc6yRL14t_hkTqGChzD6DWVTOsOWXTB3L_E6rZoVYPlHPhN-DievVL2qnOeWXDI--zEDoRDr6etGJiPsct2SQiG9ETA0RE5NETIApxVQDo0KlFPUngrI2Yc4QP52JcKnVM-ES4layt1jzVAC_rmi9Kgg-3KLZWyJ0Ah8KrA_-GYGIE-ylPeEDEXc_N_nx8Q1dFf6tAyLvIGHZUgBaReTppTaXtJkCDzWhcgG-QMvTa_CedYveglbpDfaq9QD5rW4v2lNdjF-mfpzx92q53i7gM1wTZgyl2s6649Pxabd7N-nE-iM90iMQ3s-lXDMRE-Fnws-XaHVcyjGmC-HnZ8LPsfsWftxuP2Qdbod8z3lDeFS5nkGKdjMvH9dPSr7Mmz6auBJ-XpbbP7ffrin-gaYQfjZxXf0eqI4NHRM9ZVwIdNyi640wRlrBmG3RUiqE0YROkyuYwJed7_zTr6KbTnZ933JJmUSnO8Y0HQw12g3ccSvQWMskbyo6WJjV9Yohg7ooH0Dtzfx_uFau01ZQoW3bq5azng62aTtrB83k0Ilu6LkzLaHTwY7CDmJQBxyZFFwOA-vEYR4HJ2XXuFb0HJVwbdNQipopatHxTvKDHznlDWO8Z4J2VByFQ9ka2g6tUkoaSxqKq_LLsbZZnT_46vDIWE8pPSxK45L3_cR5wEfY3xLO67pK4z6b3i6ZNHTxueQ3meLLguO9WhYo8bPffd9dq66GvttdRm0ZPyyffZMctrSM__ms92Yz4efXaW4j_zsAAP__5-WzOA">