[clang] [clang] Use constant rounding mode for floating literals (PR #90877)

Serge Pavlov via cfe-commits cfe-commits at lists.llvm.org
Mon May 6 01:17:15 PDT 2024


================
@@ -79,3 +79,16 @@ float V7 = []() -> float {
   0x0.000001p0F);
 }();
 // CHECK: @V7 = {{.*}} float 1.000000e+00
+
+template<float V> struct L {
+  constexpr L() : value(V) {}
+  float value;
+};
+
+#pragma STDC FENV_ROUND FE_DOWNWARD
----------------
spavloff wrote:

Explicit instantiation also should use the rounding mode at the point of definition. It is possible that the template is instantiated in two translation units and rounding mode is different at the points of instantiation.

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


More information about the cfe-commits mailing list