This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

egcs-1.1a: namespace problem


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]