http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49759
Summary: std::streampos == int should be ambiguous Product: gcc Version: 4.4.5 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: mathieu.malate...@gmail.com I believe the following code should not compile: #include <fstream> int main() { std::ofstream f( "bla.txt" ); std::ifstream is( "bla.txt" ); if( is.tellg() == 0 ) {} return 0; } the overload for 'operator==' is ambiguous and should be reported. Eg: line 7: error: more than one operator "==" matches these operands: built-in operator "arithmetic == arithmetic" function "std::operator==(const std::fpos<mbstate_t> &, const std::fpos<mbstate_t> &)" operand types are: std::streampos == int if( is.tellg() == 0 ) {} ^ or error: ambiguous overload for 'operator==' in '((std::istream*)is)->std::basic_istream<_CharT, _Traits>::tellg [with _CharT = char, _Traits = std::char_traits<char>]() == 0' note: candidates are: operator==(std::streamoff, int) <built-in> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/postypes.h:138: note: bool std::fpos<_StateT>::operator==(const std::fpos<_StateT>&) const [with _StateT = __mbstate_t]