【问题标题】:C2886 class/struct typedef class self inheritance usingC2886 类/结构 typedef 类自继承使用
【发布时间】:2014-03-01 05:22:04
【问题描述】:
struct Foo
{
    typedef Foo FooInner;
};

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

// 编译器:VS Express 2013 更新 1 - 编译错误 C2886

// 编译器:GCC 4.7.2 - 成功

// 错了吗?

【问题讨论】:

  • 仅供参考,clang 3.3 对此也没有任何问题。

标签: c++ class struct using


【解决方案1】:

来自MSDN Article VS 2013 是错误的。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-20
    • 2011-10-07
    • 2016-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多