https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/175709
We need to remove the pointer to the local variable we've created specifically for this complex binary operator. Fixes https://github.com/llvm/llvm-project/issues/175670 >From f8d4ca6f8e5da04408157293986b021a773cde15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]> Date: Tue, 13 Jan 2026 06:49:32 +0100 Subject: [PATCH] [clang][bytecode] Fix CK_ToVoid casts for Complex values We need to remove the pointer to the local variable we've created specifically for this complex binary operator. Fixes https://github.com/llvm/llvm-project/issues/175670 --- clang/lib/AST/ByteCode/Compiler.cpp | 4 ++++ clang/test/AST/ByteCode/complex.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index b68576158decc..a67648aa2aff9 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -1381,6 +1381,10 @@ bool Compiler<Emitter>::VisitComplexBinOp(const BinaryOperator *E) { } else { if (!this->emitPop(ResultElemT, E)) return false; + // Remove the Complex temporary pointer we created ourselves at the + // beginning of this function. + if (!Initializing) + return this->emitPopPtr(E); } } return true; diff --git a/clang/test/AST/ByteCode/complex.cpp b/clang/test/AST/ByteCode/complex.cpp index 182162d251ece..41e5dc0605c23 100644 --- a/clang/test/AST/ByteCode/complex.cpp +++ b/clang/test/AST/ByteCode/complex.cpp @@ -434,5 +434,9 @@ namespace Discard { } static_assert(test3() == 10, ""); // both-error {{not an integral constant expression}} + constexpr void V() { + (void)(1 + 2i); + } + static_assert((V(), true)); } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
