Reputation: 5060
According to the page of msvs2015rc new features constructor inheritance should be supported. Yes, it works in simple cases like this:
struct B {
B(int) {}
};
struct D : B {
using B::B; // now we can create D object with B's constructor
};
But if I'll try to create more complex example:
template <class T>
struct B
{
B(int) {}
};
template <template <class> class C, class T>
struct D : C<T>
{
using C<T>::C;
};
int main() {
D<B,int> d(42);
return 0;
}
I've got compiler errors:
error C2039: 'C': is not a member of 'B<T>'
error C2873: 'C': symbol cannot be used in a using-declaration
error C2664: 'D<B,int>::D(D<B,int> &&)': cannot convert argument 1 from 'int' to 'const D<B,int> &'
I can eliminate these errors if and only if rename template template class C
to B
:
template <template <class> class B, class T>
struct D : B<T>
{
using B<T>::B;
};
I think this is a compiler bug because all of these codes well compiled with gcc/clang.
Do anybody has another opinion about this issue?
Upvotes: 2
Views: 512