This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Using a using-declaration to prevent name hiding.
- To: egcs at cygnus dot com
- Subject: Using a using-declaration to prevent name hiding.
- From: Vaughn Cato <vcato at bellsouth dot net>
- Date: Mon, 07 Sep 1998 16:33:48 -0400
The following example from the Dec 1996 C++ Draft does not compile under
egcs 1.1 (egcs-2.91.57):
struct B {
void f(char);
void g(char);
enum E { e };
union { int x; };
};
struct D : B {
using B::f;
void f(int) { f('c'); } // calls B::f(char)
void g(int) { g('c'); } // recursively calls D::g(int)
};
It gives the following error:
cannot adjust access to `void B::f(char)' in `struct D'
because of local method `void D::f(int)' with same name
This example is from section 7.3.3.3. The compiler seems to be
conforming to section 7.3.3.1 which states
... A name specified in a using-declaration in a class or namespace
scope shall not already be a member of that scope.
There appears to be a conflict between sections 7.3.3.1 and 7.3.3.3, but
the intent as given by the example is that a using-declaration can be
used to prevent the normal name hiding that occurs.
Any comments?
Until Later,
- Vaughn