[Bug c++/67499] c++ template/overload diagnostic compression

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Aug 23 11:28:06 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67499

--- Comment #11 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
And Clang output:

<source>:5:13: error: invalid operands to binary expression ('std::ostream'
(aka 'basic_ostream<char>') and 'foo')
  std::cout << bar;
  ~~~~~~~~~ ^  ~~~
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/system_error:279:5:
note: candidate function template not viable: no known conversion from 'foo' to
'const std::error_code' for 2nd argument
    operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
    ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:505:5:
note: candidate function template not viable: no known conversion from 'foo' to
'char' for 2nd argument
    operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
    ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:511:5:
note: candidate function template not viable: no known conversion from 'foo' to
'char' for 2nd argument
    operator<<(basic_ostream<char, _Traits>& __out, char __c)
    ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:517:5:
note: candidate function template not viable: no known conversion from 'foo' to
'signed char' for 2nd argument
    operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
    ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:522:5:
note: candidate function template not viable: no known conversion from 'foo' to
'unsigned char' for 2nd argument
    operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
    ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:600:5:
note: candidate function template not viable: no known conversion from 'foo' to
'const char *' for 2nd argument
    operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
    ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:613:5:
note: candidate function template not viable: no known conversion from 'foo' to
'const signed char *' for 2nd argument
    operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
    ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:618:5:
note: candidate function template not viable: no known conversion from 'foo' to
'const unsigned char *' for 2nd argument
    operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
    ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/ostream.tcc:302:5:
note: candidate function template not viable: no known conversion from 'foo' to
'const char *' for 2nd argument
    operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
    ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:500:5:
note: candidate template ignored: deduced conflicting types for parameter
'_CharT' ('char' vs. 'foo')
    operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
    ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/basic_string.h:3591:5:
note: candidate template ignored: could not match
'basic_string<type-parameter-0-0, type-parameter-0-1, type-parameter-0-2>'
against 'foo'
    operator<<(basic_ostream<_CharT, _Traits>& __os,
    ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:583:5:
note: candidate template ignored: could not match 'const _CharT *' against
'foo'
    operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
    ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/type_traits:2230:46:
note: candidate template ignored: disabled by 'enable_if' [with _Ostream =
std::basic_ostream<char> &, _Tp = foo]
    using __enable_if_t = typename enable_if<_Cond, _Tp>::type;
                                             ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:108:7:
note: candidate function not viable: no known conversion from 'foo' to
'std::basic_ostream<char>::__ostream_type
&(*)(std::basic_ostream<char>::__ostream_type &)' (aka 'basic_ostream<char,
std::char_traits<char>> &(*)(basic_ostream<char, std::char_traits<char>> &)')
for 1st argument
      operator<<(__ostream_type& (*__pf)(__ostream_type&))
      ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:117:7:
note: candidate function not viable: no known conversion from 'foo' to
'std::basic_ostream<char>::__ios_type &(*)(std::basic_ostream<char>::__ios_type
&)' (aka 'basic_ios<char, std::char_traits<char>> &(*)(basic_ios<char,
std::char_traits<char>> &)') for 1st argument
      operator<<(__ios_type& (*__pf)(__ios_type&))
      ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:127:7:
note: candidate function not viable: no known conversion from 'foo' to
'std::ios_base &(*)(std::ios_base &)' for 1st argument
      operator<<(ios_base& (*__pf) (ios_base&))
      ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:166:7:
note: candidate function not viable: no known conversion from 'foo' to 'long'
for 1st argument
      operator<<(long __n)
      ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:170:7:
note: candidate function not viable: no known conversion from 'foo' to
'unsigned long' for 1st argument
      operator<<(unsigned long __n)
      ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:174:7:
note: candidate function not viable: no known conversion from 'foo' to 'bool'
for 1st argument
      operator<<(bool __n)
      ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:178:7:
note: candidate function not viable: no known conversion from 'foo' to 'short'
for 1st argument
      operator<<(short __n);
      ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:181:7:
note: candidate function not viable: no known conversion from 'foo' to
'unsigned short' for 1st argument
      operator<<(unsigned short __n)
      ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:189:7:
note: candidate function not viable: no known conversion from 'foo' to 'int'
for 1st argument
      operator<<(int __n);
      ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:192:7:
note: candidate function not viable: no known conversion from 'foo' to
'unsigned int' for 1st argument
      operator<<(unsigned int __n)
      ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:201:7:
note: candidate function not viable: no known conversion from 'foo' to 'long
long' for 1st argument
      operator<<(long long __n)
      ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:205:7:
note: candidate function not viable: no known conversion from 'foo' to
'unsigned long long' for 1st argument
      operator<<(unsigned long long __n)
      ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:220:7:
note: candidate function not viable: no known conversion from 'foo' to 'double'
for 1st argument
      operator<<(double __f)
      ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:224:7:
note: candidate function not viable: no known conversion from 'foo' to 'float'
for 1st argument
      operator<<(float __f)
      ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:232:7:
note: candidate function not viable: no known conversion from 'foo' to 'long
double' for 1st argument
      operator<<(long double __f)
      ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:245:7:
note: candidate function not viable: no known conversion from 'foo' to 'const
void *' for 1st argument; take the address of the argument with &
      operator<<(const void* __p)
      ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:276:7:
note: candidate function not viable: no known conversion from 'foo' to
'std::basic_ostream<char>::__streambuf_type *' (aka 'basic_streambuf<char,
std::char_traits<char>> *') for 1st argument
      operator<<(__streambuf_type* __sb);
      ^
1 warning and 1 error generated.


More information about the Gcc-bugs mailing list