https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/180539
This is the only builtin that returns a non-primitive type I think. >From 649e98054b9af191e8037eddd4f9a94f4c011138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]> Date: Mon, 9 Feb 2026 16:15:56 +0100 Subject: [PATCH] [clang][bytecode] Fix discarded builtin_complex This is the only builtin that returns a non-primitive type I think. --- clang/lib/AST/ByteCode/Compiler.cpp | 6 ++---- clang/test/AST/ByteCode/complex.cpp | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index a0138c402e143..b981cd3c7090d 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -5212,10 +5212,8 @@ bool Compiler<Emitter>::VisitBuiltinCallExpr(const CallExpr *E, if (!this->emitCallBI(E, BuiltinID, E)) return false; - if (DiscardResult && !ReturnType->isVoidType()) { - assert(ReturnT); - return this->emitPop(*ReturnT, E); - } + if (DiscardResult && !ReturnType->isVoidType()) + return this->emitPop(ReturnT.value_or(PT_Ptr), E); return true; } diff --git a/clang/test/AST/ByteCode/complex.cpp b/clang/test/AST/ByteCode/complex.cpp index 68a8e78d5b25b..4440f201bb059 100644 --- a/clang/test/AST/ByteCode/complex.cpp +++ b/clang/test/AST/ByteCode/complex.cpp @@ -319,6 +319,8 @@ namespace Builtin { constexpr _Complex float C = __builtin_complex(10.0f, 20.0); // both-error {{arguments are of different types}} + + constexpr int Discarded = (__builtin_complex(1., 2.), 12); } namespace Cmp { _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
