<html>
<head>
<base href="http://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 --- - if declaration and definition of a function differ in scope, emit a warning"
href="http://llvm.org/bugs/show_bug.cgi?id=16883">16883</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>if declaration and definition of a function differ in scope, emit a warning
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.3
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>alexander.huemer@xx.vu
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Hi,
i just stumbled upon a piece of code like this:
static int foo(void);
int foo(void)
{
volatile int a = 3;
return a;
}
According to <a href="http://std.dkuug.dk/JTC1/SC22/open/n2620/n2620.txt">http://std.dkuug.dk/JTC1/SC22/open/n2620/n2620.txt</a> --> 6.1.2.2 #7
the behavior in this situation is undefined.
If, within a translation unit, the same identifier
appears with both internal and external linkage, the
behavior is undefined.
Steps to Reproduce:
the code above goes into foo.c
$ clang -Weverything -c foo.c
Actual Results:
clang does not emit a warning when compiling with -Weverything.
scan-build does not warn either, with all checkers enabled.
Expected Results:
clang should emit a warning when compiling such code.</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>