#include <iostream>
template <typename T>
struct W
{
typedef T TT;
W(const typename W<int>::TT & m)
{
std::cout << "here" << std::endl;
}
};
int main()
{
int f;
W<int>k( f );
return 0;
}
vc11 编译,但 g++ 不起作用。
我的 gcc 版本:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=d:/usr/app/mingw-w32/bin/../libexec/gcc/i686-w64-mingw32/4.7
.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../../../build/gcc/src/configure --target=i686-w64-mingw32 --pr
efix=/c/bb/vista64-mingw32/mingw-x86-x86/build/build/root --with-sysroot=/c/bb/v
ista64-mingw32/mingw-x86-x86/build/build/root --enable-languages=all,obj-c++ --e
nable-fully-dynamic-string --disable-multilib
Thread model: win32
gcc version 4.7.0 20111219 (experimental) (GCC)
gcc 错误信息:
dd.cc:7:27: error: 'TT' in 'struct W<int>' does not name a type