https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/166908
at the point when they become proper globals. >From 16bfb5d02c11ef55197028c10c157e4f0b013ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]> Date: Fri, 7 Nov 2025 09:53:44 +0100 Subject: [PATCH] [clang][bytecode] Dummy variables can have pointers to them at the point when they become proper globals. --- clang/lib/AST/ByteCode/Program.cpp | 3 ++- clang/test/SemaCXX/cxx2b-consteval-propagate.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/clang/lib/AST/ByteCode/Program.cpp b/clang/lib/AST/ByteCode/Program.cpp index 4d34e0b0a9b46..c468303efea7e 100644 --- a/clang/lib/AST/ByteCode/Program.cpp +++ b/clang/lib/AST/ByteCode/Program.cpp @@ -197,7 +197,8 @@ UnsignedOrNone Program::createGlobal(const ValueDecl *VD, const Expr *Init) { // global variable and points to the block we just created. if (auto DummyIt = DummyVariables.find(Redecl); DummyIt != DummyVariables.end()) { - assert(!Globals[DummyIt->second]->block()->hasPointers()); + Global *Dummy = Globals[DummyIt->second]; + Dummy->block()->movePointersTo(NewGlobal->block()); Globals[DummyIt->second] = NewGlobal; DummyVariables.erase(DummyIt); } diff --git a/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp b/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp index 331fe8387e1c7..ff104243a9735 100644 --- a/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp +++ b/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp @@ -1,5 +1,7 @@ // RUN: %clang_cc1 -std=c++2a -Wno-unused-value %s -verify +// RUN: %clang_cc1 -std=c++2a -Wno-unused-value %s -verify -fexperimental-new-constant-interpreter // RUN: %clang_cc1 -std=c++2b -Wno-unused-value %s -verify +// RUN: %clang_cc1 -std=c++2b -Wno-unused-value %s -verify -fexperimental-new-constant-interpreter consteval int id(int i) { return i; } constexpr char id(char c) { return c; } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
