<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 --- - nested-extern: clang reports errors in gcc testsuite testcase"
href="http://llvm.org/bugs/show_bug.cgi?id=20245">20245</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>nested-extern: clang reports errors in gcc testsuite testcase
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mayur.p@samsung.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=12755" name="attach_12755" title="test case file">attachment 12755</a> <a href="attachment.cgi?id=12755&action=edit" title="test case file">[details]</a></span>
test case file
The following TC present in gcc testsuite
(<a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775</a>) fails in clang where as it
is successful when compiled using g++ :
extern "C" void abort();
extern int *p;
int main()
{
extern int i;
i = 1;
*p = 2;
if (i == 2)
abort ();
return 0;
}
static int i;
int *p = &i;
when compiled using clang the following errors are thrown:
nested-extern-1.C:16:12: error: static declaration of 'i' follows non-static
declaration
static int i;
^
nested-extern-1.C:8:14: note: previous definition is here
extern int i;
^
nested-extern-1.C:17:11: error: use of undeclared identifier 'i'
int *p = &i;
So wanted to know whether this is correct behaviour that clang is giving or do
we need to replicate what gcc is doing?</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>