Boost logo

Boost :

From: Eric Friedman (ebf_at_[hidden])
Date: 2002-07-02 22:46:27


Anyone have an idea as to how to make the following code work (or at
least exhibit similar behavior) under MSVC 7 or GCC 2.9.5?

Comeau compiles the code without error.

Under MSVC 7 I get:

"error C2372: 'test_using<base>::initialize' : redefinition; different
types of indirection."

Under GCC 2.9.5 I get:

"cannot adjust access to `int test_base::f(const float &)' in `struct
test_using<double,test_base>' because of local method `int
test_using<double,test_base>::f(const double &)' with same name

cannot adjust access to `int test_using<double,test_base>::f(const
double &)' in `struct test_using<int,test_using<double,test_base> >'
because of local method `int test_using<int,test_using<double,test_base>
>::f(const int &)' with same name"

Thanks,
Eric Friedman

---
struct test_base
{
	static void f() { }
};
template <typename T, typename base>
struct test_using
	: base
{
	using base::f;
	static int f(const T& t)
	{
		return t;
	}
};
int main()
{
	typedef test_using<
		  int
		, test_using<
			  double
			, test_base
			>
		> test;
	test::f(3);
	test::f(3.14);
	test::f(float(3.14));
}

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk