[LLVMbugs] [Bug 16792] New: Redeclaration of nested type misdiagosed as forward-decl
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Aug 5 02:00:25 PDT 2013
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: unassignedclangbugs at nondot.org
Reporter: imkinghan at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130805/c380293a/attachment.html>
More information about the llvm-bugs
mailing list