diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -1413,7 +1413,7 @@ if (!this->emitDupPtr(Initializer)) return false; - return this->VisitCallExpr(CE); + return this->visit(CE); } else if (const auto *DIE = dyn_cast(Initializer)) { return this->visitInitializer(DIE->getExpr()); } else if (const auto *CE = dyn_cast(Initializer)) { diff --git a/clang/test/AST/Interp/records.cpp b/clang/test/AST/Interp/records.cpp --- a/clang/test/AST/Interp/records.cpp +++ b/clang/test/AST/Interp/records.cpp @@ -98,12 +98,20 @@ int b; constexpr C() : a(100), b(200) {} + + constexpr C get() const { + return *this; + } }; constexpr C c; static_assert(c.a == 100, ""); static_assert(c.b == 200, ""); +constexpr C c2 = C().get(); +static_assert(c.a == 100, ""); +static_assert(c.b == 200, ""); + constexpr int getB() { C c; int &j = c.b;