diff --git a/clang/lib/AST/Interp/Descriptor.cpp b/clang/lib/AST/Interp/Descriptor.cpp --- a/clang/lib/AST/Interp/Descriptor.cpp +++ b/clang/lib/AST/Interp/Descriptor.cpp @@ -186,6 +186,11 @@ } static BlockDtorFn getDtorPrim(PrimType Type) { + // Floating types are special. They are primitives, but need their + // destructor called, since they might allocate memory. + if (Type == PT_Float) + return dtorTy::T>; + COMPOSITE_TYPE_SWITCH(Type, return dtorTy, return nullptr); } diff --git a/clang/test/AST/Interp/floats.cpp b/clang/test/AST/Interp/floats.cpp --- a/clang/test/AST/Interp/floats.cpp +++ b/clang/test/AST/Interp/floats.cpp @@ -125,3 +125,7 @@ constexpr A b{12}; static_assert(a.f == 0.0, ""); }; + +namespace LongDouble { + constexpr long double ld = 3.1425926539; +}