_Float16 handling changed in gcc 13?

David Aldrich david.aldrich.ntml@gmail.com
Thu Oct 17 15:31:42 GMT 2024


Thank you, that fixed it.

On Thu, Oct 17, 2024 at 4:06 PM Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
>
>
> On Thu, 17 Oct 2024 at 15:51, David Aldrich via Gcc-help <gcc-help@gcc.gnu.org> wrote:
>>
>> Hi
>>
>> I have code that compiles correctly with gcc 12 and gcc 14, but not with gcc 13:
>>
>> SIMD.h: In static member function ‘static std::complex<_Float16>
>> SIMD::reduce_add_pch(const __m256h&)’:
>> /SIMD.h:893:44: error: no matching function for call to
>> ‘std::complex<_Float16>::complex(float&, float&)’
>>   893 |         return std::complex<_Float16>(re,im);
>>       |                                            ^
>>
>> We are using C++20.
>>
>> I know that the behaviour of _Float16 changed in gcc 13 but I don't
>> know how to fix this error.
>>
>> Any suggestions please?
>
>
> There's no implicit conversion from float to the narrowing _Float16, but it shoudl work with explicit casts:
>
> return std::complex<_Float16>(static_cast<_Float16>(re), static_cast<_Float16>(im));
>
>


More information about the Gcc-help mailing list