https://bugs.llvm.org/show_bug.cgi?id=35951
Bug ID: 35951
Summary: clang permits assignment to vector/extvector elements
in a const method
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: llvm-...@redking.me.uk
CC: dav...@freebsd.org, dgre...@apple.com,
fil...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk, rjmcc...@apple.com
The following cases compile successfully on clang but not gcc:
https://godbolt.org/g/jhQeot
#if __CLANG__
typedef float float4 __attribute__((ext_vector_type(4)));
struct OhNo {
float4 v;
void AssignMe() const { v.x = 1; }
};
#endif
typedef float float4_2 __attribute__((__vector_size__(16)));
struct OhNo2 {
float4_2 v;
void AssignMe() const { v[0] = 1; }
};
I'd expect clang to report an error that we are trying to assign a value to a
read-only variable, similar to:
struct OhNo3 {
float v[4];
void AssignMe() const { v[0] = 1; }
};
error: read-only variable is not assignable:
void AssignMe() const { v[0] = 1; }
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs