Skip to content

operator=(const DataT&) is not available for swizzle_vec for NumElements > 1 #8877

Closed
@kopylovanat

Description

@kopylovanat

Describe the bug
There is operator=(const DataT& rhs) in 4.14.2.1. Vec interface , but it's not available for swizzle_vec if NumElements > 1.

To Reproduce

#include <sycl.hpp>

int main() {

  const int val = 42;
  sycl::vec<int, 2> testVec;
  testVec = val;
  testVec.template swizzle<sycl::elem::s0, sycl::elem::s1>() = val;
}

clang++ -fsycl ./sample_vec_swizzle_assignment.cpp -o sample

Output:

./sample_vec_swizzle_assignment.cpp:8:62: error: no viable overloaded '='
  testVec.template swizzle<sycl::elem::s0, sycl::elem::s1>() = val;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~
/localdisk2/nkopylox/dpcpp_compiler/bin/../include/sycl/types.hpp:1581:14: note: candidate template ignored: could not match 'const vec<DataT, IdxNum>' (aka 'const vec<int, IdxNum>') against 'const int'
  SwizzleOp &operator=(const vec<DataT, IdxNum> &Rhs) {
             ^
/localdisk2/nkopylox/dpcpp_compiler/bin/../include/sycl/types.hpp:1590:14: note: candidate template ignored: requirement '1 == 2' was not satisfied [with IdxNum = 2]
  SwizzleOp &operator=(const DataT &Rhs) {
             ^
/localdisk2/nkopylox/dpcpp_compiler/bin/../include/sycl/types.hpp:1597:14: note: candidate template ignored: requirement '1 == 2' was not satisfied [with IdxNum = 2]
  SwizzleOp &operator=(DataT &&Rhs) {
             ^
/localdisk2/nkopylox/dpcpp_compiler/bin/../include/sycl/types.hpp:1734:14: note: candidate template ignored: could not match 'const SwizzleOp<T1, T2, T3, T4, T5...>' against 'const int'
  SwizzleOp &operator=(const SwizzleOp<T1, T2, T3, T4, T5...> &Rhs) {
             ^
/localdisk2/nkopylox/dpcpp_compiler/bin/../include/sycl/types.hpp:1746:14: note: candidate template ignored: could not match 'SwizzleOp<T1, T2, T3, T4, T5...>' against 'const int'
  SwizzleOp &operator=(SwizzleOp<T1, T2, T3, T4, T5...> &&Rhs) {
             ^
/localdisk2/nkopylox/dpcpp_compiler/bin/../include/sycl/types.hpp:124:7: note: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'const int' to 'const SwizzleOp<vec<int, 2>, GetOp<int>, GetOp<int>, sycl::detail::GetOp, 0, 1>' for 1st argument
class SwizzleOp;
      ^
1 error generated.

Environment (please complete the following information):

  • OS: Red_8.2_x86_64
  • Memory: 504GB
  • CPUCount: 2 CoreCount: 64 HT: yes
  • CPU Model: Intel(R) Xeon(R) Platinum 8260M CPU @ 2.40GHz
  • Compiler version: DPC++ daily 2023-03-25

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions