5

これは私のスニペットです:

class Base{};

class Derived : private Base{};

template<class T>
class Wrapper
{
    public:
        template<typename T2>
        Wrapper( T2&& )
        { }
};

// Function declarations
void func( Base& param );
void func( Wrapper<Derived> );
void funcUnambiguous( Wrapper<Derived> );


// Here is the Call:
Derived d = Derived();  
func( d );               // <- Error

GCC 4.9 は私に与えます:error: 'Base' is an inaccessible base of 'Derived'

私がするのに対し

Derived d = Derived();

funcUnambiguous( d );

それはうまく動作します。

不正な形式であっても、安価なキャストのみを必要とする関数は、暗黙的ではあるが高価なキャスト関数を隠しているようです。誰も手がかりを持っていますか?

4

1 に答える 1