This is the mail archive of the 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]

Bug (?) in namespaces and overloading resolution


The following code does not compile on 19980604, I believe it should.
It works if the defintion of struct X is moved into namespace B.
The error messages reported are:

egcs/ In function `struct C::Y & operator <<<A::X>(struct C::Y &, const struct A::X &)':
egcs/   instantiated from here
egcs/ no match for `_IO_ostream_withassign & << const A::X &'
/homes/njs3/pub/cc/egcs-980604/include/g++/iostream.h:77: candidates are: ostream::operator <<(char)
/homes/njs3/pub/cc/egcs-980604/include/g++/iostream.h:78:                 ostream::operator <<(unsigned char)
/homes/njs3/pub/cc/egcs-980604/include/g++/iostream.h:108:                 ostream::operator <<(streambuf *)
egcs/                 operator <<<A::X>(C::Y &, const A::X &)

Please CC me on any response, thanks.

#include <iostream.h>

using namespace std;

namespace A {
	struct X { };	

namespace B {

	using A::X;

	inline ostream& operator<<(ostream& ostr, const X& x)
		return ostr;

namespace C {

	struct Y { };
	template<class T>
	Y& operator<<(Y& y, const T& t)
		cerr << t;
		return y;

using namespace B;
using namespace C;

	X	x;
	Y	y;
	y << x;

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