https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/223680
Do the same thing the current interpreter does: nothing. >From 699579c0f76d1606f06fd9571151fb9444e330ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]> Date: Tue, 15 Sep 2026 14:46:12 +0200 Subject: [PATCH] [clang][bytecode] Fix castBackMemberPointer with null member pointers Do the same thing the current interpreter does: nothing. --- clang/lib/AST/ByteCode/Interp.cpp | 5 +++++ clang/test/AST/ByteCode/memberpointers.cpp | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp index a951827d5d27f..5b0f16abdbf46 100644 --- a/clang/lib/AST/ByteCode/Interp.cpp +++ b/clang/lib/AST/ByteCode/Interp.cpp @@ -3203,6 +3203,11 @@ static bool castBackMemberPointer(InterpState &S, const MemberPointer &MemberPtr, int32_t BaseOffset, const RecordDecl *BaseDecl) { + if (!MemberPtr.getDecl()) { + S.Stk.push<MemberPointer>(MemberPtr); + return true; + } + const CXXRecordDecl *Expected; if (MemberPtr.getPathLength() >= 2) Expected = MemberPtr.getPathEntry(MemberPtr.getPathLength() - 2); diff --git a/clang/test/AST/ByteCode/memberpointers.cpp b/clang/test/AST/ByteCode/memberpointers.cpp index e2a154914c83b..f077b7ad7ffac 100644 --- a/clang/test/AST/ByteCode/memberpointers.cpp +++ b/clang/test/AST/ByteCode/memberpointers.cpp @@ -314,3 +314,9 @@ namespace Errors { static_assert(test1(), ""); // both-error {{not an integral constant expression}} #endif } + +namespace NoDecl { + struct S {}; + struct T : S {}; + void (T::*foo)(void *) = (void (S::*)(void *))(void (T::*)(void *))0; +} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
