<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/66262>66262</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Issues with determining valid constant expressions in `cxx2b`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
enhancement,
clang,
clang:frontend,
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
antoniofrighetto
</td>
</tr>
</table>
<pre>
C++23 permits a variable of non-literal type to be defined in a constant expression scope, but clang seems to have a hard time handling it. The following code does not compile with `-std=cxx2b` on latest clang:
```cpp
struct A { int y; };
struct B : virtual public A {};
struct X : public B {};
constexpr void foo() {
X x;
x.B::y = 1;
}
```
Godbolt: https://godbolt.org/z/rTdaf545e.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsU8GOqzgQ_Jrm0kpE2oS8HDiEQVnt_R3e1dhN8MrYCDeZZL_-CYhmNKOREMjtqq52UdYpuVtgruBYw7HJ9Cx9nCodJAYXu8ndehaJWRvts3oDqoFqUjjyNDhJqPGuJ6dbzxg7DDHsvBOetEd5jowSsWW03LnAFl1AjSaGJDoI8mOcOCUXAyYTRwZ6w3YWNF6HGybmIS38Xt8ZNfZ6sihuYOx1sN6FGzrZ4--esYvex_elYqJltJEThiho4jA6z_jupEco810SC6oxjwe1UOYYA3otnF6SoC6QN5BfoMy3x4zjVkkyzUbwgnCq0QXBJ6ga4dSAqr8gagR1wbubZNYex7n1zmy0H8B_VvALVH8Hbe_VrcUpvEdnsYsR6BfQeUWvCMQ_-Phg4WNfLwdRlyeCavDw2e_UfDvetvwn2jZ6WUbpRca0sOkKdL1tG_s43YCu_wNdp99Wd8fiyPvMVsqe1VlnXB3Kc1FSqajI-qpQutSG8y43v4w6de2hy_Nct4VlKk9tkbmKclL5-aAOJ0V5se-UPZpOExnTnfjcQZHzoJ3fe38fFvHMpTRzVZZUUuZ1yz6tYSXi0OtgeOAgQAT0BkTbr_y6UpduikE42I-NwO-49l0qxyabqkVu1863BEXuXZL0OYA48esF2dodG_x3oaYtWZZluQxhCeBde2d_inhawr9E6hW-bJ589c1vJ_3c7k0cgK6L9uuzG6f4HxsBuq4TJ6DrasbfAAAA__9Axim4">