[PATCH] D155574: [clang][ASTImporter] Fix import of recursive field initializer.
Ding Fei via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 25 00:57:43 PDT 2023
danix800 added inline comments.
================
Comment at: clang/lib/AST/ASTImporter.cpp:3936-3937
+ return std::move(Err);
+ if (ToInitializer)
+ ToField->setInClassInitializer(ToInitializer);
return ToField;
----------------
Initializer could indirectly depends on this field and set the initializer while importing.
`setInClassInitializer()` asserts that initializer should not be set more than once:
```
static int ref_A();
static int ref_B();
struct A {
int a = ref_B();
};
struct B {
int b = ref_A();
};
int ref_B() { B b; return b.b; }
int ref_A() { A a; return a.a; }
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155574/new/
https://reviews.llvm.org/D155574
More information about the cfe-commits
mailing list