[clang] 7bae454 - [clang][bytecode] Allow constructor calls on extern RVO pointers (#195654)

via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 08:22:45 PDT 2026


Author: Timm Baeder
Date: 2026-05-04T17:22:39+02:00
New Revision: 7bae454bdb848e4b1896f9e3d9a95c4c61ed1749

URL: https://github.com/llvm/llvm-project/commit/7bae454bdb848e4b1896f9e3d9a95c4c61ed1749
DIFF: https://github.com/llvm/llvm-project/commit/7bae454bdb848e4b1896f9e3d9a95c4c61ed1749.diff

LOG: [clang][bytecode] Allow constructor calls on extern RVO pointers (#195654)

Turns out 8b258206819d48ff6410ea99f3c63738318bd178 caused a regression
in that it broke function calls with extern RVO pointers. However, that
check in CheckInvoke() seems unneeded anyway, so remove it.

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/Interp.cpp
    clang/test/AST/ByteCode/records.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index 0fa4021cae1f6..30b54f5dab236 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -904,8 +904,6 @@ static bool CheckInvoke(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
   if (!Ptr.isDummy() && !isConstexprUnknown(Ptr)) {
     if (!CheckLive(S, OpPC, Ptr, AK_MemberCall))
       return false;
-    if (!CheckExtern(S, OpPC, Ptr))
-      return false;
     if (!CheckRange(S, OpPC, Ptr, AK_MemberCall))
       return false;
     if (!IsCtorDtor && !CheckLifetime(S, OpPC, Ptr, AK_MemberCall))

diff  --git a/clang/test/AST/ByteCode/records.cpp b/clang/test/AST/ByteCode/records.cpp
index 2b21f5f8ecf45..20ead8cffdd99 100644
--- a/clang/test/AST/ByteCode/records.cpp
+++ b/clang/test/AST/ByteCode/records.cpp
@@ -2000,3 +2000,14 @@ namespace EmptyRecords {
                                   // both-note {{in call}}
   constexpr int testc = f(e3, 3);
 }
+
+namespace RVOPtrIsExtern {
+  struct __ph {
+  } extern const _1;
+  constexpr void test(__ph) {}
+  constexpr bool test_all() {
+    test(_1);
+    return true;
+  }
+  static_assert(test_all(), "");
+}


        


More information about the cfe-commits mailing list