【问题标题】:CLANG: Elaborated type refers to a typedef errorCLANG:详细类型是指 typedef 错误
【发布时间】:2017-07-23 21:20:24
【问题描述】:

这是我的代码 sn-p

template <class T>
struct ClassFriendMaker
{
    typedef T Type;
};

template <class T>

class Singleton
{
    friend class ClassFriendMaker<T>::Type; // Problem in this line
    //Other declaration 
}

当用 CLANG 编译时,它给了我一个错误:

error: elaborated type refers to a typedef
   friend class ClassFriendMaker<T>::Type;
                                      ^

我可以知道什么是错的吗?谢谢你

【问题讨论】:

    标签: clang


    【解决方案1】:

    在朋友声明中将 class 替换为 typename

    friend class ClassFriendMaker<T>::Type;
    
    friend typename ClassFriendMaker<T>::Type;
    

    【讨论】:

      猜你喜欢
      • 2014-08-25
      • 2017-05-13
      • 1970-01-01
      • 2015-04-09
      • 2012-09-11
      • 1970-01-01
      • 2013-09-09
      • 1970-01-01
      • 2013-09-01
      相关资源
      最近更新 更多