记录详情

Compile Error

foo.cc: In function ‘int main(int, char**)’:
foo.cc:54:14: error: no match for ‘operator<<’ (operand types are ‘std::ostream’ {aka ‘std::basic_ostream<char>’} and ‘Complex’)
   54 |         cout << c1 + c2 + c3 << endl;
      |         ~~~~ ^~ ~~~~~~~~~~~~
      |         |               |
      |         |               Complex
      |         std::ostream {aka std::basic_ostream<char>}
In file included from iostream:41:
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:110:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  110 |       operator<<(__ostream_type& (*__pf)(__ostream_type&))
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:110:36: note:   no known conversion for argument 1 from ‘Complex’ to ‘std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)’ {aka ‘std::basic_ostream<char>& (*)(std::basic_ostream<char>&)’}
  110 |       operator<<(__ostream_type& (*__pf)(__ostream_type&))
      |                  ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:119:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]’
  119 |       operator<<(__ios_type& (*__pf)(__ios_type&))
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:119:32: note:   no known conversion for argument 1 from ‘Complex’ to ‘std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)’ {aka ‘std::basic_ios<char>& (*)(std::basic_ios<char>&)’}
  119 |       operator<<(__ios_type& (*__pf)(__ios_type&))
      |                  ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:129:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  129 |       operator<<(ios_base& (*__pf) (ios_base&))
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:129:30: note:   no known conversion for argument 1 from ‘Complex’ to ‘std::ios_base& (*)(std::ios_base&)’
  129 |       operator<<(ios_base& (*__pf) (ios_base&))
      |                  ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:168:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  168 |       operator<<(long __n)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:168:23: note:   no known conversion for argument 1 from ‘Complex’ to ‘long int’
  168 |       operator<<(long __n)
      |                  ~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:172:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  172 |       operator<<(unsigned long __n)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:172:32: note:   no known conversion for argument 1 from ‘Complex’ to ‘long unsigned int’
  172 |       operator<<(unsigned long __n)
      |                  ~~~~~~~~~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:176:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  176 |       operator<<(bool __n)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:176:23: note:   no known conversion for argument 1 from ‘Complex’ to ‘bool’
  176 |       operator<<(bool __n)
      |                  ~~~~~^~~
In file included from /nix/gcc-13.2.0/include/c++/13.2.0/ostream:880:
/nix/gcc-13.2.0/include/c++/13.2.0/bits/ostream.tcc:96:5: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]’
   96 |     basic_ostream<_CharT, _Traits>::
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/ostream.tcc:97:22: note:   no known conversion for argument 1 from ‘Complex’ to ‘short int’
   97 |     operator<<(short __n)
      |                ~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:183:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  183 |       operator<<(unsigned short __n)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:183:33: note:   no known conversion for argument 1 from ‘Complex’ to ‘short unsigned int’
  183 |       operator<<(unsigned short __n)
      |                  ~~~~~~~~~~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/ostream.tcc:110:5: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]’
  110 |     basic_ostream<_CharT, _Traits>::
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/ostream.tcc:111:20: note:   no known conversion for argument 1 from ‘Complex’ to ‘int’
  111 |     operator<<(int __n)
      |                ~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:194:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  194 |       operator<<(unsigned int __n)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:194:31: note:   no known conversion for argument 1 from ‘Complex’ to ‘unsigned int’
  194 |       operator<<(unsigned int __n)
      |                  ~~~~~~~~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:203:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  203 |       operator<<(long long __n)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:203:28: note:   no known conversion for argument 1 from ‘Complex’ to ‘long long int’
  203 |       operator<<(long long __n)
      |                  ~~~~~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:207:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  207 |       operator<<(unsigned long long __n)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:207:37: note:   no known conversion for argument 1 from ‘Complex’ to ‘long long unsigned int’
  207 |       operator<<(unsigned long long __n)
      |                  ~~~~~~~~~~~~~~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:222:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  222 |       operator<<(double __f)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:222:25: note:   no known conversion for argument 1 from ‘Complex’ to ‘double’
  222 |       operator<<(double __f)
      |                  ~~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:226:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  226 |       operator<<(float __f)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:226:24: note:   no known conversion for argument 1 from ‘Complex’ to ‘float’
  226 |       operator<<(float __f)
      |                  ~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:234:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  234 |       operator<<(long double __f)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:234:30: note:   no known conversion for argument 1 from ‘Complex’ to ‘long double’
  234 |       operator<<(long double __f)
      |                  ~~~~~~~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:292:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  292 |       operator<<(const void* __p)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:292:30: note:   no known conversion for argument 1 from ‘Complex’ to ‘const void*’
  292 |       operator<<(const void* __p)
      |                  ~~~~~~~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/ostream.tcc:124:5: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]’
  124 |     basic_ostream<_CharT, _Traits>::
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/ostream.tcc:125:34: note:   no known conversion for argument 1 from ‘Complex’ to ‘std::basic_ostream<char>::__streambuf_type*’ {aka ‘std::basic_streambuf<char>*’}
  125 |     operator<<(__streambuf_type* __sbin)
      |                ~~~~~~~~~~~~~~~~~~^~~~~~
In file included from /nix/gcc-13.2.0/include/c++/13.2.0/string:54,
                 from /nix/gcc-13.2.0/include/c++/13.2.0/bits/locale_classes.h:40,
                 from /nix/gcc-13.2.0/include/c++/13.2.0/bits/ios_base.h:41,
                 from /nix/gcc-13.2.0/include/c++/13.2.0/ios:44,
                 from /nix/gcc-13.2.0/include/c++/13.2.0/ostream:40:
/nix/gcc-13.2.0/include/c++/13.2.0/bits/basic_string.h:4020:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’
 4020 |     operator<<(basic_ostream<_CharT, _Traits>& __os,
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/basic_string.h:4020:5: note:   template argument deduction/substitution failed:
foo.cc:54:27: note:   ‘Complex’ is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’
   54 |         cout << c1 + c2 + c3 << endl;
      |                           ^~
In file included from /nix/gcc-13.2.0/include/c++/13.2.0/bits/ios_base.h:46:
/nix/gcc-13.2.0/include/c++/13.2.0/system_error:339:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)’
  339 |     operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/system_error:339:5: note:   template argument deduction/substitution failed:
foo.cc:54:25: note:   cannot convert ‘Complex::operator+(Complex&)(c3)’ (type ‘Complex’) to type ‘const std::error_code&’
   54 |         cout << c1 + c2 + c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:554:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)’
  554 |     operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:554:5: note:   template argument deduction/substitution failed:
foo.cc:54:27: note:   deduced conflicting types for parameter ‘_CharT’ (‘char’ and ‘Complex’)
   54 |         cout << c1 + c2 + c3 << endl;
      |                           ^~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:564:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)’
  564 |     operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:564:5: note:   template argument deduction/substitution failed:
foo.cc:54:25: note:   cannot convert ‘Complex::operator+(Complex&)(c3)’ (type ‘Complex’) to type ‘char’
   54 |         cout << c1 + c2 + c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:570:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)’
  570 |     operator<<(basic_ostream<char, _Traits>& __out, char __c)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:570:5: note:   template argument deduction/substitution failed:
foo.cc:54:25: note:   cannot convert ‘Complex::operator+(Complex&)(c3)’ (type ‘Complex’) to type ‘char’
   54 |         cout << c1 + c2 + c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:581:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)’
  581 |     operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:581:5: note:   template argument deduction/substitution failed:
foo.cc:54:25: note:   cannot convert ‘Complex::operator+(Complex&)(c3)’ (type ‘Complex’) to type ‘signed char’
   54 |         cout << c1 + c2 + c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:586:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)’
  586 |     operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:586:5: note:   template argument deduction/substitution failed:
foo.cc:54:25: note:   cannot convert ‘Complex::operator+(Complex&)(c3)’ (type ‘Complex’) to type ‘unsigned char’
   54 |         cout << c1 + c2 + c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:645:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)’
  645 |     operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:645:5: note:   template argument deduction/substitution failed:
foo.cc:54:27: note:   mismatched types ‘const _CharT*’ and ‘Complex’
   54 |         cout << c1 + c2 + c3 << endl;
      |                           ^~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/ostream.tcc:307:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)’
  307 |     operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/ostream.tcc:307:5: note:   template argument deduction/substitution failed:
foo.cc:54:25: note:   cannot convert ‘Complex::operator+(Complex&)(c3)’ (type ‘Complex’) to type ‘const char*’
   54 |         cout << c1 + c2 + c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:662:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)’
  662 |     operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:662:5: note:   template argument deduction/substitution failed:
foo.cc:54:25: note:   cannot convert ‘Complex::operator+(Complex&)(c3)’ (type ‘Complex’) to type ‘const char*’
   54 |         cout << c1 + c2 + c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:675:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)’
  675 |     operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:675:5: note:   template argument deduction/substitution failed:
foo.cc:54:25: note:   cannot convert ‘Complex::operator+(Complex&)(c3)’ (type ‘Complex’) to type ‘const signed char*’
   54 |         cout << c1 + c2 + c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:680:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)’
  680 |     operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:680:5: note:   template argument deduction/substitution failed:
foo.cc:54:25: note:   cannot convert ‘Complex::operator+(Complex&)(c3)’ (type ‘Complex’) to type ‘const unsigned char*’
   54 |         cout << c1 + c2 + c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:801:5: note: candidate: ‘template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)’
  801 |     operator<<(_Ostream&& __os, const _Tp& __x)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:801:5: note:   template argument deduction/substitution failed:
/nix/gcc-13.2.0/include/c++/13.2.0/ostream: In substitution of ‘template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_ostream<char>&; _Tp = Complex]’:
foo.cc:54:20:   required from here
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:801:5: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
foo.cc:42:26: note: candidate: ‘std::ostream& operator<<(std::ostream&, Complex&)’ (near match)
   42 |         friend ostream & operator<<(ostream &out,  Complex &c)
      |                          ^~~~~~~~
foo.cc:42:26: note:   conversion of argument 2 would be ill-formed:
foo.cc:54:25: error: cannot bind non-const lvalue reference of type ‘Complex&’ to an rvalue of type ‘Complex’
   54 |         cout << c1 + c2 + c3 << endl;
      |                 ~~~~~~~~^~~~
foo.cc:55:14: error: no match for ‘operator<<’ (operand types are ‘std::ostream’ {aka ‘std::basic_ostream<char>’} and ‘Complex’)
   55 |         cout << c1 * c2 * c3 << endl;
      |         ~~~~ ^~ ~~~~~~~~~~~~
      |         |               |
      |         |               Complex
      |         std::ostream {aka std::basic_ostream<char>}
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:110:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  110 |       operator<<(__ostream_type& (*__pf)(__ostream_type&))
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:110:36: note:   no known conversion for argument 1 from ‘Complex’ to ‘std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)’ {aka ‘std::basic_ostream<char>& (*)(std::basic_ostream<char>&)’}
  110 |       operator<<(__ostream_type& (*__pf)(__ostream_type&))
      |                  ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:119:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]’
  119 |       operator<<(__ios_type& (*__pf)(__ios_type&))
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:119:32: note:   no known conversion for argument 1 from ‘Complex’ to ‘std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)’ {aka ‘std::basic_ios<char>& (*)(std::basic_ios<char>&)’}
  119 |       operator<<(__ios_type& (*__pf)(__ios_type&))
      |                  ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:129:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  129 |       operator<<(ios_base& (*__pf) (ios_base&))
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:129:30: note:   no known conversion for argument 1 from ‘Complex’ to ‘std::ios_base& (*)(std::ios_base&)’
  129 |       operator<<(ios_base& (*__pf) (ios_base&))
      |                  ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:168:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  168 |       operator<<(long __n)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:168:23: note:   no known conversion for argument 1 from ‘Complex’ to ‘long int’
  168 |       operator<<(long __n)
      |                  ~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:172:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  172 |       operator<<(unsigned long __n)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:172:32: note:   no known conversion for argument 1 from ‘Complex’ to ‘long unsigned int’
  172 |       operator<<(unsigned long __n)
      |                  ~~~~~~~~~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:176:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  176 |       operator<<(bool __n)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:176:23: note:   no known conversion for argument 1 from ‘Complex’ to ‘bool’
  176 |       operator<<(bool __n)
      |                  ~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/ostream.tcc:96:5: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]’
   96 |     basic_ostream<_CharT, _Traits>::
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/ostream.tcc:97:22: note:   no known conversion for argument 1 from ‘Complex’ to ‘short int’
   97 |     operator<<(short __n)
      |                ~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:183:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  183 |       operator<<(unsigned short __n)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:183:33: note:   no known conversion for argument 1 from ‘Complex’ to ‘short unsigned int’
  183 |       operator<<(unsigned short __n)
      |                  ~~~~~~~~~~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/ostream.tcc:110:5: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]’
  110 |     basic_ostream<_CharT, _Traits>::
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/ostream.tcc:111:20: note:   no known conversion for argument 1 from ‘Complex’ to ‘int’
  111 |     operator<<(int __n)
      |                ~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:194:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  194 |       operator<<(unsigned int __n)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:194:31: note:   no known conversion for argument 1 from ‘Complex’ to ‘unsigned int’
  194 |       operator<<(unsigned int __n)
      |                  ~~~~~~~~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:203:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  203 |       operator<<(long long __n)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:203:28: note:   no known conversion for argument 1 from ‘Complex’ to ‘long long int’
  203 |       operator<<(long long __n)
      |                  ~~~~~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:207:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  207 |       operator<<(unsigned long long __n)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:207:37: note:   no known conversion for argument 1 from ‘Complex’ to ‘long long unsigned int’
  207 |       operator<<(unsigned long long __n)
      |                  ~~~~~~~~~~~~~~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:222:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  222 |       operator<<(double __f)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:222:25: note:   no known conversion for argument 1 from ‘Complex’ to ‘double’
  222 |       operator<<(double __f)
      |                  ~~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:226:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  226 |       operator<<(float __f)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:226:24: note:   no known conversion for argument 1 from ‘Complex’ to ‘float’
  226 |       operator<<(float __f)
      |                  ~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:234:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  234 |       operator<<(long double __f)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:234:30: note:   no known conversion for argument 1 from ‘Complex’ to ‘long double’
  234 |       operator<<(long double __f)
      |                  ~~~~~~~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:292:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]’
  292 |       operator<<(const void* __p)
      |       ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:292:30: note:   no known conversion for argument 1 from ‘Complex’ to ‘const void*’
  292 |       operator<<(const void* __p)
      |                  ~~~~~~~~~~~~^~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/ostream.tcc:124:5: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]’
  124 |     basic_ostream<_CharT, _Traits>::
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/ostream.tcc:125:34: note:   no known conversion for argument 1 from ‘Complex’ to ‘std::basic_ostream<char>::__streambuf_type*’ {aka ‘std::basic_streambuf<char>*’}
  125 |     operator<<(__streambuf_type* __sbin)
      |                ~~~~~~~~~~~~~~~~~~^~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/basic_string.h:4020:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’
 4020 |     operator<<(basic_ostream<_CharT, _Traits>& __os,
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/basic_string.h:4020:5: note:   template argument deduction/substitution failed:
foo.cc:55:27: note:   ‘Complex’ is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’
   55 |         cout << c1 * c2 * c3 << endl;
      |                           ^~
/nix/gcc-13.2.0/include/c++/13.2.0/system_error:339:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)’
  339 |     operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/system_error:339:5: note:   template argument deduction/substitution failed:
foo.cc:55:25: note:   cannot convert ‘Complex::operator*(Complex&)(c3)’ (type ‘Complex’) to type ‘const std::error_code&’
   55 |         cout << c1 * c2 * c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:554:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)’
  554 |     operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:554:5: note:   template argument deduction/substitution failed:
foo.cc:55:27: note:   deduced conflicting types for parameter ‘_CharT’ (‘char’ and ‘Complex’)
   55 |         cout << c1 * c2 * c3 << endl;
      |                           ^~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:564:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)’
  564 |     operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:564:5: note:   template argument deduction/substitution failed:
foo.cc:55:25: note:   cannot convert ‘Complex::operator*(Complex&)(c3)’ (type ‘Complex’) to type ‘char’
   55 |         cout << c1 * c2 * c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:570:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)’
  570 |     operator<<(basic_ostream<char, _Traits>& __out, char __c)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:570:5: note:   template argument deduction/substitution failed:
foo.cc:55:25: note:   cannot convert ‘Complex::operator*(Complex&)(c3)’ (type ‘Complex’) to type ‘char’
   55 |         cout << c1 * c2 * c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:581:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)’
  581 |     operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:581:5: note:   template argument deduction/substitution failed:
foo.cc:55:25: note:   cannot convert ‘Complex::operator*(Complex&)(c3)’ (type ‘Complex’) to type ‘signed char’
   55 |         cout << c1 * c2 * c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:586:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)’
  586 |     operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:586:5: note:   template argument deduction/substitution failed:
foo.cc:55:25: note:   cannot convert ‘Complex::operator*(Complex&)(c3)’ (type ‘Complex’) to type ‘unsigned char’
   55 |         cout << c1 * c2 * c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:645:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)’
  645 |     operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:645:5: note:   template argument deduction/substitution failed:
foo.cc:55:27: note:   mismatched types ‘const _CharT*’ and ‘Complex’
   55 |         cout << c1 * c2 * c3 << endl;
      |                           ^~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/ostream.tcc:307:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)’
  307 |     operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/ostream.tcc:307:5: note:   template argument deduction/substitution failed:
foo.cc:55:25: note:   cannot convert ‘Complex::operator*(Complex&)(c3)’ (type ‘Complex’) to type ‘const char*’
   55 |         cout << c1 * c2 * c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:662:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)’
  662 |     operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:662:5: note:   template argument deduction/substitution failed:
foo.cc:55:25: note:   cannot convert ‘Complex::operator*(Complex&)(c3)’ (type ‘Complex’) to type ‘const char*’
   55 |         cout << c1 * c2 * c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:675:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)’
  675 |     operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:675:5: note:   template argument deduction/substitution failed:
foo.cc:55:25: note:   cannot convert ‘Complex::operator*(Complex&)(c3)’ (type ‘Complex’) to type ‘const signed char*’
   55 |         cout << c1 * c2 * c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:680:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)’
  680 |     operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:680:5: note:   template argument deduction/substitution failed:
foo.cc:55:25: note:   cannot convert ‘Complex::operator*(Complex&)(c3)’ (type ‘Complex’) to type ‘const unsigned char*’
   55 |         cout << c1 * c2 * c3 << endl;
      |                 ~~~~~~~~^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:801:5: note: candidate: ‘template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)’
  801 |     operator<<(_Ostream&& __os, const _Tp& __x)
      |     ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:801:5: note:   template argument deduction/substitution failed:
/nix/gcc-13.2.0/include/c++/13.2.0/ostream: In substitution of ‘template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_ostream<char>&; _Tp = Complex]’:
foo.cc:55:20:   required from here
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:801:5: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
foo.cc:42:26: note: candidate: ‘std::ostream& operator<<(std::ostream&, Complex&)’ (near match)
   42 |         friend ostream & operator<<(ostream &out,  Complex &c)
      |                          ^~~~~~~~
foo.cc:42:26: note:   conversion of argument 2 would be ill-formed:
foo.cc:55:25: error: cannot bind non-const lvalue reference of type ‘Complex&’ to an rvalue of type ‘Complex’
   55 |         cout << c1 * c2 * c3 << endl;
      |                 ~~~~~~~~^~~~

信息

递交者
类型
递交
题目
P1011 OO2-1 复数类的算术、赋值运算符的重载
比赛
2024春 面向对象的程序设计方法(第2场作业赛)
语言
C++
递交时间
2024-04-05 16:26:53
评测时间
2024-04-05 16:26:53
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes