clang编译器上的std stringstream bug:无法将字符串提取到指针;

时间:2015-08-03 09:38:06

标签: c++ pointers clang stringstream

此处示例代码如何在编译器clang上获得此错误

std::stringstream sstream;
int val = 10;
sstream << static_cast<void*>(&val); //"0x7fff5fbff94c"
void* ptr = nullptr;
sstream >> ptr; //0x7fff5
bool match = ptr == &val; //false
auto status = sstream.rdstate(); // 2- failbit

此错误仅在Clang编译器上发生: http://melpon.org/wandbox/permlink/wLwz0B1MDn2qDMId

我可以做错什么或者这是一个真正的吵闹错误吗?

0 个答案:

没有答案