<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 rejects both "const" and "const*" as type-name inside _Generic"
href="https://bugs.llvm.org/show_bug.cgi?id=48799">48799</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang rejects both "const" and "const*" as type-name inside _Generic
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>11.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>cuoq@trust-in-soft.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>The _Generic construction expects a type-name in each association:
<a href="https://cigix.me/c17#6.5.1.1.p1">https://cigix.me/c17#6.5.1.1.p1</a>
It seems to me and to GCC that "const" and "const*" are type-name
(<a href="https://cigix.me/c17#6.7.7.p1">https://cigix.me/c17#6.7.7.p1</a> )
However, Clang rejects each of the last two lines of the following function
with the message “error: expected a typeâ€.
int main(void) {
const x = sizeof (const) + _Alignof ( const );
const *p = &(const){1};
_Generic(x, const :1,int:2);
_Generic(&x, const *:3,int*:4);
}
Compiler Explorer link: <a href="https://gcc.godbolt.org/z/8aYec8">https://gcc.godbolt.org/z/8aYec8</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>