Index: clang/lib/AST/Interp/Program.h =================================================================== --- clang/lib/AST/Interp/Program.h +++ clang/lib/AST/Interp/Program.h @@ -41,6 +41,14 @@ public: Program(Context &Ctx) : Ctx(Ctx) {} + ~Program() { + // Records might actually allocate memory themselves, but they + // are allocated using a BumpPtrAllocator. Call their desctructors + // here manually so they are properly freeing their resources. + for (auto It : Records) + It.second->~Record(); + } + /// Marshals a native pointer to an ID for embedding in bytecode. unsigned getOrCreateNativePointer(const void *Ptr); Index: clang/test/AST/Interp/references.cpp =================================================================== --- clang/test/AST/Interp/references.cpp +++ clang/test/AST/Interp/references.cpp @@ -75,7 +75,6 @@ constexpr const int &MCE = 1; // expected-error{{must be initialized by a constant expression}} -#if 0 struct S { int i, j; }; @@ -89,5 +88,4 @@ return j; } // FIXME: Should be accepted. -static_assert(RefToMemberExpr() == 11, ""); -#endif +static_assert(RefToMemberExpr() == 11, ""); // expected-error {{not an integral constant expression}}