As Praetorian's comment mentions, the problem is with the T()
default value. Based on the error details, using base::T
apparently confuses the compiler into searching for T()
as a call to non-static member function of base
rather than the construction of an instance of type T
.
Here's an interesting fix that works in MSVC 2005 x86 (I haven't tried any other compiler). Note that T()
is preserved. This either disambiguates using base::T
or just forces T
to reference the inherited type and not the using
one (which are apparently not the same thing to the compiler).
//...
template<class>
struct derived : base
{
using base::T;
derived(T = static_cast<T>( T() )) { } //No error
};
//...
Edit: Try changing base
to this and see what error messages you get:
struct base { struct T{T(){}}; };
I get the original C2597
, but also this:
error C2440: 'default argument' : cannot convert from '' to 'base::T'
No constructor could take the source type, or constructor overload resolution was ambiguous
I don't know what the compiler means by ''
there, but it's probably a similar problem with the original definition of base
. This compiles fine if I remove the using base::T;
line.