jeudi 6 avril 2017

In using-declaration, can dependent names render to constructors after template substitution?

In this example:

template<class T>
struct S : T
{
    using T::X;
};

T::X is a dependent name that refers to the member X in T. If S<T> is instantiated with T = X:

struct X
{
    X(int) {}
};
...
S<X> s(42);

Will the using-declaration become inheriting-constructor?

Clang rejects the code DEMO, while g++ accepts it.

Note that if we write:

using T::X::X;

Both compilers accept the code and treat it as inheriting-constructor. Is using T::X allowed to become inheriting-constructor by standard?

Aucun commentaire:

Enregistrer un commentaire