[clang] [clang][CIR] Convert fixed-point values to bool enums like bool (PR #245930)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 25 01:21:52 PST 2026
================
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c23 -ffixed-point -fclangir -emit-cir %s -o %t.cir
+// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c23 -ffixed-point -fclangir -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s
+
+// C23 6.7.3.3p16: conversion to an enumeration with a fixed bool underlying
+// type has the semantics of conversion to bool, including for fixed-point
+// sources.
+
+enum E : bool { F, T };
+
+int to_bool(_Accum x) { return (enum E)x; }
----------------
xlauko wrote:
Could you port the cases from `clang/test/CodeGen/enum-bool.c` instead?
https://github.com/llvm/llvm-project/pull/245930
More information about the cfe-commits
mailing list