<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 --- - Redeclaration of nested type misdiagosed as forward-decl"
href="http://llvm.org/bugs/show_bug.cgi?id=16792">16792</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Redeclaration of nested type misdiagosed as forward-decl
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.3
</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>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>imkinghan@gmail.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>Compiling the following C++11 program (`-Wall -std=c++11`):
// main.cpp
struct X
{
struct Y {};
};
struct X::Y xy; /*B*/
struct X::Y; /*A*/
int main()
{
return 0;
}
// EOF
clang 3.3 diagnoses line /*A*/:
`error: forward declaration of struct cannot have a nested name specifier`
I don't believe there is an error there. The line is correctly parsed as a
`simple-declaration` of `struct X::Y` the form
`decl-specifier-seq[opt] init-declarator-list[opt];`
in which the `decl-specifier-seq` is present and the `init-declarator-list`
is absent. But it is not a forward declaration because `X::Y` is aleady
defined. And clang considers it already defined, because it finds
no fault with the previous line /*B*/.
G++ 4.8.1, diagnoses /*A*/:
`warning: declaration ‘struct X::Y’ does not declare anything`
which I take to mean that nothing of the defined type `X::Y` is declared.
Similarly Intel C++ 13.1.3. MSVC++ 120 (`/Wall`) has nothing to say of the
line.</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>