C2886类/ struct typedef类使用自继承

时间:2014-03-01 05:22:05

标签: c++ class struct using

struct Foo
{
    typedef Foo FooInner;
};

struct Bar:Foo
{
    using Foo::FooInner;  // <-
};

// compiler:VS Express 2013 Update 1 - 编译错误C2886

//编译器:GCC 4.7.2 - 成功

//是不是错了?

1 个答案:

答案 0 :(得分:0)

MSDN Article来看,VS 2013是错误的。

'class :: identifier':符号不能在成员using-declaration中使用 using声明使用符号,例如命名空间名称。 using声明用于声明基类成员。

相关问题