This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C++ question (BUG?)


> gcc-2.95.2 and later snapshots happyly compile the following piece of
> code. So does Sun's CC-5.0 :-). Compaq's cxx chokes on it. So is this
> desired behaviour?

I'm not sure, but I think the C++ standard says this is
well-formed. In 9, [class]/2

# A class­name is inserted into the scope in which it is declared
# immediately after the class­name is seen. The class­name is also
# inserted into the scope of the class itself. For purposes of access
# checking, the inserted class name is treated as if it were a public
# member name.

So foo::foo is a class-name referring to ::foo. Therefore,
foo::foo::foo is also a class-name.

If you question this line of reasoning, please discuss it in one of
the public C++ fora first, eg. comp.lang.c++.moderated, or
comp.std.c++. It may be that this is a defect in the C++ standard, in
which case you may want to submit a defect report.

Regards,
Martin

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]