<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 - Combining a pointer to array of const TYPE with an otherwise size-compatible array of TYPE should work and yield only a _pedantic_ warning"
href="https://bugs.llvm.org/show_bug.cgi?id=44855">44855</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Combining a pointer to array of const TYPE with an otherwise size-compatible array of TYPE should work and yield only a _pedantic_ warning
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>9.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>pskocik@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>C++ allows e.g., combining (int const(*)[100])x with (int (*)[100])y as in
0? (int(*)[100])0 : (int const(*)[100])0
yielding an expression of type int const(*)[100].
The C standard technically disallows this (could be considered a defect in the
standard) but this kind of combining/conversion is completely harmless and so
GCC only warns about it under -pedantic.
Consequently, under GCC, it is possible to disable these warnings by enclosing
the "offending" code snippets in (__extension__({ ;}).
This doesn't work on clang, because the above elicits a full (rather than just
a pedantic) warning on clang.
Furthermore, the combined type on clang is void* rather than int(*)[100].
The gcc behavior is more useful.
Some examples with comments at: <a href="https://gcc.godbolt.org/z/e7sXdB">https://gcc.godbolt.org/z/e7sXdB</a></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>