http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50462
--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-09-20
13:59:47 UTC ---
Clang does only marginally better because of its selective typedef unwrapping
and avoiding printing back expressions, but then it goes and prints all
candidates:
/tmp/webcompile/_7569_0.cc:10:13: error: invalid operands to binary expression
('ostream' (aka 'basic_ostream<char>') and '<overloaded function type>')
{ std::cout << v.size; }
~~~~~~~~~ ^ ~~~~~~
In file included from /tmp/webcompile/_7569_0.cc:1:
In file included from /usr/include/c++/4.3/iostream:44:
/usr/include/c++/4.3/ostream:111:7: note: candidate function not viable: no
overload of 'size' matching '__ostream_type &(*)(__ostream_type &)' for 1st
argument
operator<<(__ostream_type& (*__pf)(__ostream_type&))
^
/usr/include/c++/4.3/ostream:120:7: note: candidate function not viable: no
overload of 'size' matching '__ios_type &(*)(__ios_type &)' for 1st argument
operator<<(__ios_type& (*__pf)(__ios_type&))
^
/usr/include/c++/4.3/ostream:130:7: note: candidate function not viable: no
overload of 'size' matching 'std::ios_base &(*)(std::ios_base &)' for 1st
argument
operator<<(ios_base& (*__pf) (ios_base&))
^
/usr/include/c++/4.3/ostream:168:7: note: candidate function not viable: no
overload of 'size' matching 'long' for 1st argument
operator<<(long __n)
^
/usr/include/c++/4.3/ostream:172:7: note: candidate function not viable: no
overload of 'size' matching 'unsigned long' for 1st argument
operator<<(unsigned long __n)
^
/usr/include/c++/4.3/ostream:176:7: note: candidate function not viable: no
overload of 'size' matching 'bool' for 1st argument
operator<<(bool __n)
^
/usr/include/c++/4.3/ostream:180:7: note: candidate function not viable: no
overload of 'size' matching 'short' for 1st argument
operator<<(short __n);
^
/usr/include/c++/4.3/ostream:183:7: note: candidate function not viable: no
overload of 'size' matching 'unsigned short' for 1st argument
operator<<(unsigned short __n)
^
/usr/include/c++/4.3/ostream:191:7: note: candidate function not viable: no
overload of 'size' matching 'int' for 1st argument
operator<<(int __n);
^
/usr/include/c++/4.3/ostream:194:7: note: candidate function not viable: no
overload of 'size' matching 'unsigned int' for 1st argument
operator<<(unsigned int __n)
^
/usr/include/c++/4.3/ostream:203:7: note: candidate function not viable: no
overload of 'size' matching 'long long' for 1st argument
operator<<(long long __n)
^
/usr/include/c++/4.3/ostream:207:7: note: candidate function not viable: no
overload of 'size' matching 'unsigned long long' for 1st argument
operator<<(unsigned long long __n)
^
/usr/include/c++/4.3/ostream:212:7: note: candidate function not viable: no
overload of 'size' matching 'double' for 1st argument
operator<<(double __f)
^
/usr/include/c++/4.3/ostream:216:7: note: candidate function not viable: no
overload of 'size' matching 'float' for 1st argument
operator<<(float __f)
^
/usr/include/c++/4.3/ostream:224:7: note: candidate function not viable: no
overload of 'size' matching 'long double' for 1st argument
operator<<(long double __f)
^
/usr/include/c++/4.3/ostream:228:7: note: candidate function not viable: no
overload of 'size' matching 'const void *' for 1st argument
operator<<(const void* __p)
^
/usr/include/c++/4.3/ostream:253:7: note: candidate function not viable: no
overload of 'size' matching '__streambuf_type *' (aka 'basic_streambuf<char,
std::char_traits<char> > *') for 1st argument
operator<<(__streambuf_type* __sb);
^
/usr/include/c++/4.3/ostream:449:5: note: candidate function [with _CharT =
char, _Traits = std::char_traits<char>] not viable: no overload of 'size'
matching 'char' for 2nd argument
operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
^
/usr/include/c++/4.3/ostream:454:5: note: candidate function [with _CharT =
char, _Traits = std::char_traits<char>] not viable: no overload of 'size'
matching 'char' for 2nd argument
operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
^
/usr/include/c++/4.3/ostream:460:5: note: candidate function [with _Traits =
std::char_traits<char>] not viable: no overload of 'size' matching 'char' for
2nd argument
operator<<(basic_ostream<char, _Traits>& __out, char __c)
^
/usr/include/c++/4.3/ostream:466:5: note: candidate function [with _Traits =
std::char_traits<char>] not viable: no overload of 'size' matching 'signed
char' for 2nd argument
operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
^
/usr/include/c++/4.3/ostream:471:5: note: candidate function [with _Traits =
std::char_traits<char>] not viable: no overload of 'size' matching 'unsigned
char' for 2nd argument
operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
^
/usr/include/c++/4.3/ostream:491:5: note: candidate function [with _CharT =
char, _Traits = std::char_traits<char>] not viable: no overload of 'size'
matching 'const char *' for 2nd argument
operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
^
/usr/include/c++/4.3/ostream:508:5: note: candidate function [with _Traits =
std::char_traits<char>] not viable: no overload of 'size' matching 'const char
*' for 2nd argument
operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
^
/usr/include/c++/4.3/ostream:521:5: note: candidate function [with _Traits =
std::char_traits<char>] not viable: no overload of 'size' matching 'const
signed char *' for 2nd argument
operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
^
/usr/include/c++/4.3/ostream:526:5: note: candidate function [with _Traits =
std::char_traits<char>] not viable: no overload of 'size' matching 'const
unsigned char *' for 2nd argument
operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
^
In file included from /tmp/webcompile/_7569_0.cc:1:
In file included from /usr/include/c++/4.3/iostream:44:
In file included from /usr/include/c++/4.3/ostream:568:
/usr/include/c++/4.3/bits/ostream.tcc:325:5: note: candidate function [with
_CharT = char, _Traits = std::char_traits<char>] not viable: no overload of
'size' matching 'const char *' for 2nd argument
operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
^
In file included from /tmp/webcompile/_7569_0.cc:1:
In file included from /usr/include/c++/4.3/iostream:44:
In file included from /usr/include/c++/4.3/ostream:44:
In file included from /usr/include/c++/4.3/ios:47:
In file included from /usr/include/c++/4.3/bits/ios_base.h:47:
In file included from /usr/include/c++/4.3/bits/locale_classes.h:46:
In file included from /usr/include/c++/4.3/string:57:
/usr/include/c++/4.3/bits/basic_string.h:2419:5: note: candidate template
ignored: couldn't infer template argument '_Alloc'
operator<<(basic_ostream<_CharT, _Traits>& __os,
^
2 warnings and 1 error generated.