用 VS2010 编译Gtest 1.6.0 源码出错

编译CMake生成的项目出错。

gtest-printers_test.cc
D:\Program Files\Microsoft Visual Studio 10.0\VC\include\tuple(127):
   error C2440: “初始化”: 无法从“int”转换为“void *”从整型转换为
   指针类型要求 reinterpret_cast、C 样式转换或函数样式转换
D:\Program Files\Microsoft Visual Studio 10.0\VC\include\tuple(127):
   参见对正在编译的函数 模板 实例化“...省略”的引用

问题出在把NULL赋给void*指针。

gtest-printers_test.cc 代码中这几行出的问题

const char* const str = "8";  
tuple<bool, char, short, testing::internal::Int32, testing::internal::Int64, float, double, const char*, void*, string>
t10(false, "a", 3, 4, 5, 1.5F, -2.5, str, NULL, "10");  

将最后一行的 NULL_static_cast<void>(NULL)_* 代替就可以编译通过。

参考:“Google Groups - Re: [googletest] Minor fix for gtest-printers_test”