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

    <tr>
        <th>Summary</th>
        <td>
            `consteval` constructor cannot store `this` inside object
        </td>
    </tr>

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

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

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

<pre>
    Unlike GCC & MSVC, Clang refuses to compile this https://godbolt.org/z/WYr58Ge9s --

```cpp
struct B {
  const void* immortal_;
  consteval B() : immortal_{this} {}
};
constexpr static B b;
```

The error suggests that the frontend wrongly thinks that `this` is a pointer to a temporary:

```
<source>:6:20: error: call to consteval function 'B::B' is not a constant expression
    6 | constexpr static B b;
 |                    ^
<source>:6:20: note: pointer to temporary is not a constant expression
<source>:6:20: note: temporary created here
```


</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEU0mPqzgQ_jXFpZTI2Gw5cICk06c5zaY5jQxUwNPGRrZJT79f_2TS69saWbJRbV99VZ_0Xo2GqIa8hfyUyDVM1tXeSPcwSx_IJZ0dnuo_jVYPhPfHIwIv8Lff_zoCP-JRSzOio8vqyWOw2Nt5UZowTMrjFMLiQTTAz8DPox06q8PeuhH4-Qvw89__uLy6p4PH3Q5YE0_BbqdfFmCND27tA7YIZQusQeyt8QGvVg3AG1TzbF2Q-l8Q78x0lRpb4BXwA4J471a2EReUpy1heYoVy9Mt-hb7_-LQBxlUjy12N8srqBvGPyZCcs469Os4kg8ewyQDhonw4qwJZAZ8dNaM-inyYB6eHaBgW_mCofIocbHKBHKRNomB5sU66Z4iXx-5iG9x9HZ1PYG4A9EUIBrOYm8bkPjopda3AbxQcFlNH5Q1CLxsY1bRtMDLWNvYgPLmKk3A2DV5r6zZWEQsEMoj_pyRzfyDD_K7X4E1NlC83zX-2vZnsD5N-papdyQDDTiRo-_Hlwy1GA7iIBOq0zLLBC8LkSVTXYgq6y8VqwQrLnkqZJXzqjh0gygGUaWHRNWc8ZxlKeOCl2m2Z0XHLgeW8rQUnF0IMkazVHqv9XWOe54o71eqU5HzKk207Ej7TWmcG3rEzQqcR-G5OgbtunX0kDGtfPBvaYIKmuooi5fpxiXafqJArMNemsieD9bRh0UzXg2EtvuP-pCsTtffiFKFae32vZ2Bn2O952u3OBtDgJ83lB74-bmNa82_BgAA__9nwkv0">