This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
egcs-1.1a: namespace problem
- To: egcs-bugs at cygnus dot com
- Subject: egcs-1.1a: namespace problem
- From: Ryszard Kabatek <rysio at rumcajs dot chemie dot uni-halle dot de>
- Date: Thu, 10 Sep 1998 15:44:40 +0200 (CEST)
- cc: egcs at cygnus dot com
The sample below does not compile,
because both 'A::X' and 'A::Y' are undeclared in the namespace B.
That's wrong!
When compiling the function 'B::func',
the compiler should first search the namespace 'B',
then the namespaces of the function parameters ('A')
and then the global namespace.
// sample.cc
namespace A {
class X {public: virtual ~X(){}};
class Y : public X {};
}
namespace B {
void func(A::Y& y)
{
Y y1(y);
X x;
x = y;
}
}
int main()
{
A::Y y;
B::func(y);
}
My configuration:
Linux (RedHat 5.1), Pentium II
Ryszard Kabatek
Martin-Luther University Halle-Wittenberg
Department of Physical Chemistry
Geusaer Str. 88, 06217 Merseburg, Germany
Tel. +49 3461 46 2487 Fax. +49 3461 46 2129
e-mail: kabatek@chemie.uni-halle.de