The PR reapply https://github.com/llvm/llvm-project/pull/97308. - Implement [CWG1815](https://wg21.link/CWG1815): Support lifetime extension of temporary created by aggregate initialization using a default member initializer. - Fix crash that introduced in https://github.com/llvm/llvm-project/pull/97308. In `InitListChecker::FillInEmptyInitForField`, when we enter rebuild-default-init context, we copy all the contents of the parent context to the current context, which will cause the `MaybeODRUseExprs` to be lost. But we don't need to copy the entire context, only the `DelayedDefaultInitializationContext` was required, which is used to build `SourceLocExpr`, etc. --------- Signed-off-by: yronglin <yronglin777@gmail.com>
22 lines
352 B
C++
22 lines
352 B
C++
// RUN: %clang_cc1 -o - -emit-llvm -triple x86_64-linux-gnu %s
|
|
|
|
// Check there are no crash issue CodeGen action.
|
|
// https://github.com/llvm/llvm-project/pull/97308
|
|
struct a {
|
|
} constexpr b;
|
|
class c {
|
|
public:
|
|
c(a);
|
|
};
|
|
class B {
|
|
public:
|
|
using d = int;
|
|
struct e {
|
|
enum { f } g;
|
|
int h;
|
|
c i;
|
|
d j{};
|
|
};
|
|
};
|
|
B::e k{B::e::f, int(), b};
|