egcs-1.1a: namespace problem
Ryszard Kabatek
rysio@rumcajs.chemie.uni-halle.de
Thu Sep 10 10:38:00 GMT 1998
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
More information about the Gcc
mailing list