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

    <tr>
        <th>Summary</th>
        <td>
            Weird behavior when returning pointer to static local variable from consteval function
        </td>
    </tr>

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

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

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

<pre>
    https://godbolt.org/z/j58z8175s


```cpp
#include <print>

consteval const int* foo() {
        static constexpr int x = 5;
        return &x;
}

int main() {
        std::print("{}", *foo());
}
```

GCC prints `5` as expected, but Clang prints `0`.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsUtuSoyAQ_Zr2pWtS0gQ1Dz5k4rifsM-IGJklYAFmsvP1WySZTfZSRSlFnz7n9EXGaI5O6xbEK4iukGuafWjf1OegfxSDH3-2c0pLBL4H6oH6ox8Hb9PGhyNQ_wnUv4vms2G1iFB2UO7_-Fbl7ahlub8QN07ZddQI_LAE4xLwt-cc5V1M-iwtXm-YEbTHyXugBmiHUL9-4XcxyWTUDakvS8hovCDwDgXwBy7otAaHQNXl8Vx3z7o58ySN-6_KmOvn-5vfDKAcr7t8oQMC7X_7y-dfia9GPCt-OxzwyhgRqlJAVaKMqC-LVkmPmXdYEx6sdMcnXGbZ3AiKseXjju9koVtWc7YTW0G8mFvBqokL2agdiVLziQtivGl4LVUtxy0vTEslbRljDWuo2fKNqBQ1FZOTEFwyVcG21Cdp7Mba8ykPuzAxrrplrKpqKqwctI3XpSFy-gOv0dwN0RWhzUkvw3qMsC2tiSk-aJJJVrfftQkjDnqWZ-MDfsza4W1GJhfrjUs6YPJ4H7D1Slo8y2DkYDVOwZ_wsSjT6lQy3hVrsH-vq0nzOmyUPwH12cT997IE_65VAuqv1iNQf6_t3NKvAAAA__9eW-fl">