@@ -1334,6 +1334,7 @@ bool Compiler<Emitter>::visitInitList(ArrayRef<const Expr *> Inits,
1334
1334
1335
1335
auto initPrimitiveField = [=](const Record::Field *FieldToInit,
1336
1336
const Expr *Init, PrimType T) -> bool {
1337
+ InitStackScope<Emitter> ISS (this , isa<CXXDefaultInitExpr>(Init));
1337
1338
if (!this ->visit (Init))
1338
1339
return false ;
1339
1340
@@ -1344,6 +1345,7 @@ bool Compiler<Emitter>::visitInitList(ArrayRef<const Expr *> Inits,
1344
1345
1345
1346
auto initCompositeField = [=](const Record::Field *FieldToInit,
1346
1347
const Expr *Init) -> bool {
1348
+ InitStackScope<Emitter> ISS (this , isa<CXXDefaultInitExpr>(Init));
1347
1349
InitLinkScope<Emitter> ILS (this , InitLink::Field (FieldToInit->Offset ));
1348
1350
// Non-primitive case. Get a pointer to the field-to-initialize
1349
1351
// on the stack and recurse into visitInitializer().
@@ -4088,12 +4090,7 @@ template <class Emitter>
4088
4090
bool Compiler<Emitter>::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *E) {
4089
4091
SourceLocScope<Emitter> SLS (this , E);
4090
4092
4091
- bool Old = InitStackActive;
4092
- InitStackActive =
4093
- !(E->getUsedContext ()->getDeclKind () == Decl::CXXConstructor);
4094
- bool Result = this ->delegate (E->getExpr ());
4095
- InitStackActive = Old;
4096
- return Result;
4093
+ return this ->delegate (E->getExpr ());
4097
4094
}
4098
4095
4099
4096
template <class Emitter >
@@ -4151,6 +4148,9 @@ bool Compiler<Emitter>::VisitCXXThisExpr(const CXXThisExpr *E) {
4151
4148
// instance pointer of the current function frame, but e.g. to the declaration
4152
4149
// currently being initialized. Here we emit the necessary instruction(s) for
4153
4150
// this scenario.
4151
+ if (!InitStackActive || !E->isImplicit ())
4152
+ return this ->emitThis (E);
4153
+
4154
4154
if (InitStackActive && !InitStack.empty ()) {
4155
4155
unsigned StartIndex = 0 ;
4156
4156
for (StartIndex = InitStack.size () - 1 ; StartIndex > 0 ; --StartIndex) {
0 commit comments