2017-06-15 35 views
0

這裏是我的代碼片斷CLANG:闡述類型是指一個typedef錯誤

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

template <class T> 

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

當鏗鏘編譯,它給了我一個錯誤:

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

我想知道什麼是錯的?三江源

回答

1

更換類型名稱在朋友的聲明

friend class ClassFriendMaker<T>::Type; 

friend typename ClassFriendMaker<T>::Type; 
相關問題