【发布时间】:2015-01-08 08:18:20
【问题描述】:
以下 MWE 在 gcc 4.8.2 上编译,但在 MSVC 2008 上不编译(公司政策)
struct B
{
};
struct A
{
typedef B Handler;
};
template<typename T>
struct Foo
{
typedef typename T::Handler Type;
};
template<typename T>
struct Bar
{
friend struct Foo<T>::Type; // MSVC 2008 does not like this
typedef typename Foo<T>::Type Foo;
};
int main()
{
}
MSVC 2008 错误
error C2649: 'Foo<T>::Type' : is not a 'struct'
这是一个编译器错误还是我在这里做了非法的事情?更重要的是有解决办法吗?
【问题讨论】:
标签: c++ templates visual-c++ language-lawyer friend