* Jakub Jelinek:

> The g++.dg/reflect/anon4.C test FAILs on i686-linux, because with
> excess precision the store to .c rounds to double precision, but comparison
> of it against 3.14 constant doesn't.
>
> Tested on x86_64-linux and i686-linux, committed to trunk as obvious.
>
> 2026-03-02  Jakub Jelinek  <[email protected]>
>
>       * g++.dg/reflect/anon4.C (test): Use (double) 3.14 instead of 3.14 in
>       comparisons.
>
> --- gcc/testsuite/g++.dg/reflect/anon4.C.jj   2026-03-02 07:43:12.513785271 
> +0100
> +++ gcc/testsuite/g++.dg/reflect/anon4.C      2026-03-02 07:56:49.168129712 
> +0100
> @@ -28,6 +28,6 @@ void test ()
>  
>    constexpr foo bar1 { .i = 42, .c = 3.14 };
>  
> -  static_assert (bar1.c == 3.14);
> -  static_assert (bar1.[: ^^foo::c :] == 3.14);
> +  static_assert (bar1.c == (double) 3.14);
> +  static_assert (bar1.[: ^^foo::c :] == (double) 3.14);
>  }

I'm curious why this happens.  Shouldn't 3.14 have type double in the
first place?  Does GCC represent double values using long double
internally?

Thanks,
Florian

Reply via email to