[clang] [clang][bytecode] Fix a std::optional<bool> mishap (PR #167091)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 7 21:05:50 PST 2025


https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/167091

>From aae3c5d1a01f51798e18d447506152d1d94cfbfd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Sat, 8 Nov 2025 05:20:29 +0100
Subject: [PATCH] [clang][bytecode] Fix a std::optional<bool> mishap

This is about the value saved in the std::optional, not about whether
the optional has a value at all.
---
 clang/lib/AST/ByteCode/Compiler.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 84f7e6287609c..f2cdfff209d7a 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -2508,7 +2508,7 @@ bool Compiler<Emitter>::VisitAbstractConditionalOperator(
   };
 
   if (std::optional<bool> BoolValue = getBoolValue(Condition)) {
-    if (BoolValue)
+    if (*BoolValue)
       return visitChildExpr(TrueExpr);
     return visitChildExpr(FalseExpr);
   }



More information about the cfe-commits mailing list