[clang] dc1a886 - [clang][bytecode] Fix CK_ToVoid casts for Complex values (#175709)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 12 23:19:31 PST 2026
Author: Timm Baeder
Date: 2026-01-13T08:19:27+01:00
New Revision: dc1a886fb9df0754dc80c908b227094c14866b77
URL: https://github.com/llvm/llvm-project/commit/dc1a886fb9df0754dc80c908b227094c14866b77
DIFF: https://github.com/llvm/llvm-project/commit/dc1a886fb9df0754dc80c908b227094c14866b77.diff
LOG: [clang][bytecode] Fix CK_ToVoid casts for Complex values (#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
Added:
Modified:
clang/lib/AST/ByteCode/Compiler.cpp
clang/test/AST/ByteCode/complex.cpp
Removed:
################################################################################
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));
}
More information about the cfe-commits
mailing list