Skip to content

Commit 2dda8a2

Browse files
committed
Revert "[clang][Interp] Fix init chain in local initializers"
This reverts commit 86187ed. Seems like this breaks buildbots: https://lab.llvm.org/buildbot/#/builders/56/builds/1638
1 parent 0ad6ac8 commit 2dda8a2

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

clang/lib/AST/Interp/Compiler.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3577,7 +3577,6 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD, bool Topleve
35773577
return !Init || (checkDecl() && initGlobal(*GlobalIndex));
35783578
} else {
35793579
VariableScope<Emitter> LocalScope(this, VD);
3580-
InitLinkScope<Emitter> ILS(this, InitLink::Decl(VD));
35813580

35823581
if (VarT) {
35833582
unsigned Offset = this->allocateLocalPrimitive(
@@ -3912,8 +3911,7 @@ bool Compiler<Emitter>::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *E) {
39123911
SourceLocScope<Emitter> SLS(this, E);
39133912

39143913
bool Old = InitStackActive;
3915-
InitStackActive =
3916-
!(E->getUsedContext()->getDeclKind() == Decl::CXXConstructor);
3914+
InitStackActive = !isa<FunctionDecl>(E->getUsedContext());
39173915
bool Result = this->delegate(E->getExpr());
39183916
InitStackActive = Old;
39193917
return Result;

clang/test/AST/Interp/records.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,15 +1482,3 @@ namespace FloatAPValue {
14821482
ClassTemplateArgRefTemplate<ClassTemplateArgObj.Arg> ClassTemplateArgRefObj;
14831483
}
14841484
#endif
1485-
1486-
namespace LocalWithThisPtrInit {
1487-
struct S {
1488-
int i;
1489-
int *p = &i;
1490-
};
1491-
constexpr int foo() {
1492-
S s{2};
1493-
return *s.p;
1494-
}
1495-
static_assert(foo() == 2, "");
1496-
}

0 commit comments

Comments
 (0)