<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - clang permits assignment to vector/extvector elements in a const method"
href="https://bugs.llvm.org/show_bug.cgi?id=35951">35951</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang permits assignment to vector/extvector elements in a const method
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>llvm-dev@redking.me.uk
</td>
</tr>
<tr>
<th>CC</th>
<td>davide@freebsd.org, dgregor@apple.com, filcab@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk, rjmccall@apple.com
</td>
</tr></table>
<p>
<div>
<pre>The following cases compile successfully on clang but not gcc:
<a href="https://godbolt.org/g/jhQeot">https://godbolt.org/g/jhQeot</a>
#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; }</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>