llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> This is the only builtin that returns a non-primitive type I think. --- Full diff: https://github.com/llvm/llvm-project/pull/180539.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/Compiler.cpp (+2-4) - (modified) clang/test/AST/ByteCode/complex.cpp (+2) ``````````diff 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 { `````````` </details> https://github.com/llvm/llvm-project/pull/180539 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
