のVisual Studio 2015で正常に動作するために使用されるこのコードが、それは長くないのVisual Studio 2015のアップデートで動作します。1.それは次のエラーで失敗しフレンドクラスは、保護部材にアクセスすることはできません
class Foo
{
protected:
virtual ~Foo() {};
friend class Foo__init;
};
class Foo__init
{
public:
Foo _init;
};
static Foo__init _Foo_init;
:
Error C2248 'Foo::~Foo': cannot access protected member declared in class 'Foo'
これはコンパイラのバグですか?コードが不正ですか? hereから
あなたはFooのデストラクタをpublicにしたいと思うかもしれません。 –
私はそれについて尋ねていません。 :) –
'Foo'の定義の前に' class Foot__init; 'を置くとどうなりますか? – Holt