avt77 added a comment.
In https://reviews.llvm.org/D42530#995227, @rjmccall wrote:
> That's still just const-propagation. The const qualifier on the pointee type
> of this should propagate to the l-value resulting from the member access, and
> the vector-specific projection logic should continue to propagate const to
> the type of the element l-value.
I'm afraid it's wrong because from my point of view Clang generates wrong
message for test OhNo3 (see err_typecheck_assign_const.cpp). It should not be
"read-only variable is not assignable" because v is not read-only variable.
Any other non-const method is able to change this variable w/o any problems.
The the same is for OhNo and OhNo2.
BTW, gcc generates
error: assignment of read-only location ‘*(const float*)(&((const
and that's OK because we try to change the value through
const-pointer-to-const. Am I right?
cfe-commits mailing list