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: unassignedclangb...@nondot.org
Reporter: mli...@suse.cz
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk
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
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs