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

This is about the value saved in the std::optional, not about whether the 
optional has a value at all.

>From 1ebcbfc920b44d61d60763a6afadd0dcd32e03e0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]>
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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index 84f7e6287609c..d0368feda0052 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -7,6 +7,7 @@
 
//===----------------------------------------------------------------------===//
 
 #include "Compiler.h"
+#include "ByteCode/Interp.h"
 #include "ByteCodeEmitter.h"
 #include "Context.h"
 #include "FixedPoint.h"
@@ -2508,7 +2509,7 @@ bool Compiler<Emitter>::VisitAbstractConditionalOperator(
   };
 
   if (std::optional<bool> BoolValue = getBoolValue(Condition)) {
-    if (BoolValue)
+    if (*BoolValue)
       return visitChildExpr(TrueExpr);
     return visitChildExpr(FalseExpr);
   }

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to