Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions clang/lib/AST/ByteCode/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3287,6 +3287,7 @@ template <class Emitter> bool Compiler<Emitter>::visit(const Expr *E) {

if (!this->emitGetPtrLocal(*LocalIndex, E))
return false;
InitLinkScope<Emitter> ILS(this, InitLink::Temp(*LocalIndex));
return this->visitInitializer(E);
}

Expand Down Expand Up @@ -4254,9 +4255,6 @@ bool Compiler<Emitter>::VisitCXXThisExpr(const CXXThisExpr *E) {
// instance pointer of the current function frame, but e.g. to the declaration
// currently being initialized. Here we emit the necessary instruction(s) for
// this scenario.
if (!InitStackActive || !E->isImplicit())
return this->emitThis(E);

if (InitStackActive && !InitStack.empty()) {
unsigned StartIndex = 0;
for (StartIndex = InitStack.size() - 1; StartIndex > 0; --StartIndex) {
Expand Down
6 changes: 6 additions & 0 deletions clang/test/AST/ByteCode/records.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1653,3 +1653,9 @@ namespace ExprWithCleanups {
constexpr auto F = true ? 1i : 2i;
static_assert(F == 1i, "");
}

namespace ExplicitThisInTemporary {
struct B { B *p = this; };
constexpr bool g(B b) { return &b == b.p; }
static_assert(g({}), "");
}