[clang] Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (PR #92527)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 5 00:51:14 PDT 2024
bgra8 wrote:
Here's the reproducer:
```c++
struct a {
virtual int *b();
};
template <class c> struct d : a {
int *b() { new c; }
};
int *e(a *);
struct f {
char *g;
};
struct h {};
struct i {
i(const f &);
i(h);
};
struct l {
i j = i({.g = ""});
};
int *k = e(new d<l>);
struct n : l {};
int *m = e(new d<n>);
```
Compilation command:
```
$ clang -c repro.cc
```
This compiles fine with `clang-18`, trunk `gcc` and previous `clang` revision.
@yronglin can you please have a look?
https://github.com/llvm/llvm-project/pull/92527
More information about the cfe-commits
mailing list