https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118546

            Bug ID: 118546
           Summary: std::experimental::simd operator== fails to compile
                    with clang++ 19.1.0 on x86-64-v4
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lee.imple at gmail dot com
  Target Milestone: ---

The following code fails to compile with clang++ 19.1.0 with the compilation
options `-march=x86-64-v4 -std=c++20`. Online link:
https://godbolt.org/z/sxqsKrv9e .

```c++
#include <experimental/simd>
#include <cstdint>

using deduce_t_element = std::experimental::simd<
    std::uint64_t,
    std::experimental::simd_abi::deduce_t<std::uint64_t, 4>
>;

auto f(deduce_t_element e) {
    return e == 0;
}
```

The error message (copied from godbolt):

```
In file included from <source>:1:
In file included from
/opt/compiler-explorer/gcc-14.2.0/lib/gcc/x86_64-linux-gnu/14.2.0/../../../../include/c++/14.2.0/experimental/simd:80:
/opt/compiler-explorer/gcc-14.2.0/lib/gcc/x86_64-linux-gnu/14.2.0/../../../../include/c++/14.2.0/experimental/bits/simd_x86.h:4232:18:
error: static assertion failed due to requirement 'is_same_v<long long, long>'
 4232 |           static_assert(is_same_v<_Tp, __int_for_sizeof_t<_Tp>>);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/compiler-explorer/gcc-14.2.0/lib/gcc/x86_64-linux-gnu/14.2.0/../../../../include/c++/14.2.0/experimental/bits/simd_x86.h:2244:26:
note: in instantiation of function template specialization
'std::experimental::_MaskImplX86Mixin::_S_to_bits<long long, 4UL>' requested
here
 2244 |               return _MaskImpl::_S_to_bits(
      |                                 ^
/opt/compiler-explorer/gcc-14.2.0/lib/gcc/x86_64-linux-gnu/14.2.0/../../../../include/c++/14.2.0/experimental/bits/simd.h:5625:40:
note: in instantiation of function template specialization
'std::experimental::_SimdImplX86<std::experimental::simd_abi::_VecBltnBtmsk<32>>::_S_equal_to<unsigned
long, 4UL>' requested here
 5625 |     { return simd::_S_make_mask(_Impl::_S_equal_to(__x._M_data,
__y._M_data)); }
      |                                        ^
<source>:10:14: note: in instantiation of member function
'std::experimental::operator==' requested here
   10 |     return e == 0;
      |              ^
1 error generated.
Compiler returned: 1
```

Reply via email to