Global qualification in a class declarations class-head
Posted
by gf
on Stack Overflow
See other posts from Stack Overflow
or by gf
Published on 2010-05-06T13:14:34Z
Indexed on
2010/05/06
13:18 UTC
Read the original article
Hit count: 365
We found something similar to the following (don't ask ...):
namespace N {
struct A { struct B; };
}
struct A { struct B; };
using namespace N;
struct ::A::B {}; // <- point of interest
Interestingly, this compiles fine with VS2005, icc 11.1 and Comeau (online), but fails with GCC:
global qualification of class name is invalid before '{' token
From C++03, Annex A, it seems to me like GCC is right:
- the
class-head
can consist ofnested-name-specifier
andidentifier
nested-name-specifier
can't begin with a global qualification (::
)- obviously, neither can
identifier
... or am i overlooking something?
© Stack Overflow or respective owner