llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> --- Full diff: https://github.com/llvm/llvm-project/pull/104437.diff 2 Files Affected: - (modified) clang/lib/AST/Interp/Descriptor.cpp (+8) - (modified) clang/test/AST/Interp/lifetimes.cpp (+8) ``````````diff diff --git a/clang/lib/AST/Interp/Descriptor.cpp b/clang/lib/AST/Interp/Descriptor.cpp index 1b7d9f03f8ef0d..47b8885c9ae379 100644 --- a/clang/lib/AST/Interp/Descriptor.cpp +++ b/clang/lib/AST/Interp/Descriptor.cpp @@ -284,6 +284,14 @@ static BlockDtorFn getDtorPrim(PrimType Type) { } static BlockMoveFn getMovePrim(PrimType Type) { + if (Type == PT_Float) + return moveTy<PrimConv<PT_Float>::T>; + if (Type == PT_IntAP) + return moveTy<PrimConv<PT_IntAP>::T>; + if (Type == PT_IntAPS) + return moveTy<PrimConv<PT_IntAPS>::T>; + if (Type == PT_MemberPtr) + return moveTy<PrimConv<PT_MemberPtr>::T>; COMPOSITE_TYPE_SWITCH(Type, return moveTy<T>, return nullptr); } diff --git a/clang/test/AST/Interp/lifetimes.cpp b/clang/test/AST/Interp/lifetimes.cpp index 9fca54fe11120a..9a99485c4a40bf 100644 --- a/clang/test/AST/Interp/lifetimes.cpp +++ b/clang/test/AST/Interp/lifetimes.cpp @@ -60,3 +60,11 @@ namespace MoveFnWorks { } static_assert(dtor_calls_dtor(), ""); } + +namespace PrimitiveMoveFn { + /// This used to crash. + void test() { + const float y = 100; + const float &x = y; + } +} `````````` </details> https://github.com/llvm/llvm-project/pull/104437 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits