<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - No diagnostic for declarations with incompatible enums"
href="https://llvm.org/bugs/show_bug.cgi?id=28212">28212</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>No diagnostic for declarations with incompatible enums
</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>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ch3root@openwall.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>It seem the declaration (1) makes clang miss incompatibility of types between
the declarations (2) and (3). This is a constraints violation:
C11, 6.7p4: "All declarations in the same scope that refer to the same object
or function shall specify compatible types."
Source code:
----------------------------------------------------------------------
unsigned x; // (1)
enum { a } x; // (2)
enum { b } x; // (3)
int main()
{
}
----------------------------------------------------------------------
Results:
----------------------------------------------------------------------
$ clang -std=c11 -Weverything -O3 test.c && ./a.out
test.c:2:12: warning: no previous extern declaration for non-static variable
'x' [-Wmissing-variable-declarations]
enum { a } x;
^
1 warning generated.
----------------------------------------------------------------------
clang version: clang version 3.9.0 (trunk 271312)
For comparison:
----------------------------------------------------------------------
$ gcc -std=c11 -pedantic -Wall -Wextra -O3 test.c && ./a.out
test.c:3:12: error: conflicting types for ‘x’
enum { b } x;
^
test.c:2:12: note: previous declaration of ‘x’ was here
enum { a } x;
^
----------------------------------------------------------------------
gcc version: gcc (GCC) 7.0.0 20160616 (experimental)</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>