Weird get() behavior

So, I was trying out building my engine with Clang and I couldn't get it to work at all. Eventually, I managed to narrow the problem down to a lexer that relies heavily on std::wstringstream::peek() and std::wstringstream::get(). More specifically, on the fact that the upper 16 bits of the returned int are reset. It is my understanding that this is standard behavior, as the function is supposed to return a wchar_t cast to an int. While the cast may not in all platforms reset the upper bits, I know it does on mine.

So my question is, what could be causing the upper bits to be filled with garbage? Bug in Clang? Incompatibility between Clang and MinGW's library? Something else entirely?
Topic archived. No new replies allowed.