This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C++ question (BUG?)
- To: hellebrandt at stochastik dot rwth-aachen dot de
- Subject: Re: C++ question (BUG?)
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Thu, 1 Jun 2000 12:37:40 +0200
- CC: gcc at gcc dot gnu dot org
- References: <200006010956.LAA30428@draco.stochastik.rwth-aachen.de>
> 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 classname is inserted into the scope in which it is declared
# immediately after the classname is seen. The classname 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