能够使用gcc访问私有数据成员,而clang适当地抱怨

时间:2017-03-03 22:13:03

标签: c++ gcc clang language-lawyer

以下代码如何与gcc-4.8一起编译没有问题,而使用clang-3.6会产生相应的错误:

  

"错误:' value_type'是' B'"

的私人会员
#include <iostream>
#include <type_traits>

struct B {
private:
    typedef int value_type;
};

int main () {
    std::cout << std::is_same< B::value_type, int >::value << std::endl;
}

0 个答案:

没有答案