http://llvm.org/bugs/show_bug.cgi?id=16792
Bug ID: 16792
Summary: Redeclaration of nested type misdiagosed as
forward-decl
Product: clang
Version: 3.3
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs