[clang] Fix codegen of consteval functions returning an empty class. (PR #93115)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Wed May 22 18:29:24 PDT 2024
efriedma-quic wrote:
I didn't think so at first glance... but yes, we do, in certain obscure cases:
```
#include <new>
struct A { char c; A(); };
struct __attribute((packed)) S { char a; int x; __attribute((aligned(2))) char y; consteval S() : x(1), a(3), y(2) {} };
struct S2 { [[no_unique_address]] S s; [[no_unique_address]] A a; };
static_assert(sizeof(S)==8 && sizeof(S2)==8);
void f2(S2 *s) { new (&s->s) S; }
```
I'll look into reworking this.
https://github.com/llvm/llvm-project/pull/93115
More information about the cfe-commits
mailing list