<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 --- - -Wdeclaration-after-statement not working"
href="https://llvm.org/bugs/show_bug.cgi?id=27493">27493</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-Wdeclaration-after-statement not working
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jhi@iki.fi
</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>$ cat das.c
int foo() {
if (0) {}
int i = 42;
return i;
}
$ clang-mp-3.7 -Wdeclaration-after-statement -c das.c
Nothing. As opposed to:
gcc-mp-5 -Wdeclaration-after-statement -c das.c
das.c: In function 'foo':
das.c:3:3: warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement]
int i = 42;
^
Note that I'm using the macports clang and gcc. Their versions:
$ clang-mp-3.7 -v
clang version 3.7.1 (tags/RELEASE_371/final)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
$ gcc-mp-5 -v
...
gcc version 5.3.0 (MacPorts gcc5 5.3.0_0)
I tried clangs 3.4, 3.5, 3.6, the same result of no warning.
I tried gccs 4.3, 4.4, 4.5, 4.6, 4.8, 4.9, emit the warning.
I also finally tried clang 3.4 on a Ubuntu precise VM, the same result of no
warning.
Don't have a clang 3.8 installation available.</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>