This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: g++.bob/inherit1 (Was: wrong error for G++ test suite case)
- To: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Subject: Re: g++.bob/inherit1 (Was: wrong error for G++ test suite case)
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 31 May 1998 23:44:35 -0300
- Cc: dcb at pncl dot co dot uk, egcs-bugs at cygnus dot com, egcs-patches at cygnus dot com
- References: <199805281750.SAA10432@eiger.pncl.co.uk> <199805311840.UAA11709@mira.isdn.cs.tu-berlin.de>
Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de> writes:
> I believe David is right here (as usual :-).
He probably is, but there's a paragraph that made me unsure about
whether this is correct or not, [expr.prim]:
11An id-expression that denotes a nonstatic data member or nonstatic
member function of a class can only be used:
[snipped unrelated cases]
--in the body of a nonstatic member function of that class or of a
class derived from that class (_class.mfct.nonstatic_), or
[...]
If we understand that C::foo denotes a nonstatic member function of
class C, the usage is invalid. However, if we understand that C::foo
denotes a member of class A, which seems the correct interpretation,
then this usage is valid, although a bit strange...
An equivalent example follows:
struct A { void foo(); };
struct C : A {};
struct B : A { void bar() { C::foo(); } };
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil