αλεχολυτ
αλεχολυτ

Reputation: 5060

Constructor inheritance for class derived from template class in visual studio 2015 rc

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:

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

Answers (1)

ixSci
ixSci

Reputation: 13718

It is a bug in the MSVC and it also appears in the latest version which they provide online. So, please, submit a bug report. Relevant discussion might be found in other SO question. It contains some excerpts from the standard which explain why it should work.

Upvotes: 3

Related Questions