https://bugs.llvm.org/show_bug.cgi?id=47379
Bug ID: 47379
Summary: error: non-const reference cannot bind to vector
element
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected]
The following code can be accepted by GCC, but not with clang:
$ cat clang-vector-access.cpp
template <typename T, int N>
struct Polyfill {
using Vec __attribute__ ((vector_size (sizeof(T) * N))) = T;
Vec v;
T& operator[](int k) { return v[k]; }
};
int main()
{
Polyfill<float, 8> x, y;
x[3] = y[2];
}
$ clang++ clang-vector-access.cpp
clang-vector-access.cpp:7:40: error: non-const reference cannot bind to vector
element
T& operator[](int k) { return v[k]; }
^~~~
clang-vector-access.cpp:13:4: note: in instantiation of member function
'Polyfill<float, 8>::operator[]' requested here
x[3] = y[2];
^
1 error generated.
$ g++ clang-vector-access.cpp
I see it handy to be able to access a vector element.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs