[clang] [Clang] [CodeGen] Fix codegen bug in constant initialisation in C23 mode (PR #84981)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 06:54:27 PDT 2024


================
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c23 %s
+
+// Division by 0 here is an error iff the variable is 'constexpr'.
+const _Bool inf1 =  (1.0/0.0 == __builtin_inf());
+constexpr _Bool inf2 = (1.0/0.0 == __builtin_inf()); // expected-error {{must be initialized by a constant expression}} expected-note {{division by zero}}
+constexpr _Bool inf3 = __builtin_inf() == __builtin_inf();
----------------
AaronBallman wrote:

Please add a newline to the end of the file.

https://github.com/llvm/llvm-project/pull/84981


More information about the cfe-commits mailing list