Quantcast
Viewing all articles
Browse latest Browse all 24

Answer by burrito1 for Generate the longest error message in C++

(22009 characters) This is something a beginner might actually run into:

Ungolfed:

#include <array>#include <iostream>int main() {  std::cout << std::array{1, 2, 3};}

Golfed:

#include <array>#include <iostream>main(){std::cout<<std::array{1};}

Compiled with Homebrew GCC 12.1 on MacOS 12.4, with no options.Error:

delete.cpp:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]    3 | main(){std::cout<<std::array{1};}      | ^~~~delete.cpp: In function 'int main()':delete.cpp:3:17: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::array<int, 1>')    3 | main(){std::cout<<std::array{1};}      |        ~~~~~~~~~^~     ~~~~~~~~      |             |          |      |             |          std::array<int, 1>      |             std::ostream {aka std::basic_ostream<char>}In file included from /opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/iostream:39,                 from delete.cpp:2:/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:108: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>]'  108 |       operator<<(__ostream_type& (*__pf)(__ostream_type&))      |       ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:108:36: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}  108 |       operator<<(__ostream_type& (*__pf)(__ostream_type&))      |                  ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:117: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>]'  117 |       operator<<(__ios_type& (*__pf)(__ios_type&))      |       ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:117:32: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}  117 |       operator<<(__ios_type& (*__pf)(__ios_type&))      |                  ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:127: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>]'  127 |       operator<<(ios_base& (*__pf) (ios_base&))      |       ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:127:30: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'std::ios_base& (*)(std::ios_base&)'  127 |       operator<<(ios_base& (*__pf) (ios_base&))      |                  ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:166: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>]'  166 |       operator<<(long __n)      |       ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:166:23: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'long int'  166 |       operator<<(long __n)      |                  ~~~~~^~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:170: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>]'  170 |       operator<<(unsigned long __n)      |       ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:170:32: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'long unsigned int'  170 |       operator<<(unsigned long __n)      |                  ~~~~~~~~~~~~~~^~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:174: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>]'  174 |       operator<<(bool __n)      |       ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:174:23: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'bool'  174 |       operator<<(bool __n)      |                  ~~~~~^~~In file included from /opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:833:/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/ostream.tcc:91:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'   91 |     basic_ostream<_CharT, _Traits>::      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/ostream.tcc:92:22: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'short int'   92 |     operator<<(short __n)      |                ~~~~~~^~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:181: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>]'  181 |       operator<<(unsigned short __n)      |       ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:181:33: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'short unsigned int'  181 |       operator<<(unsigned short __n)      |                  ~~~~~~~~~~~~~~~^~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/ostream.tcc:105:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'  105 |     basic_ostream<_CharT, _Traits>::      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/ostream.tcc:106:20: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'int'  106 |     operator<<(int __n)      |                ~~~~^~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:192: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>]'  192 |       operator<<(unsigned int __n)      |       ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:192:31: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'unsigned int'  192 |       operator<<(unsigned int __n)      |                  ~~~~~~~~~~~~~^~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:201: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>]'  201 |       operator<<(long long __n)      |       ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:201:28: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'long long int'  201 |       operator<<(long long __n)      |                  ~~~~~~~~~~^~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:205: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>]'  205 |       operator<<(unsigned long long __n)      |       ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:205:37: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'long long unsigned int'  205 |       operator<<(unsigned long long __n)      |                  ~~~~~~~~~~~~~~~~~~~^~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:220: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>]'  220 |       operator<<(double __f)      |       ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:220:25: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'double'  220 |       operator<<(double __f)      |                  ~~~~~~~^~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:224: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>]'  224 |       operator<<(float __f)      |       ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:224:24: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'float'  224 |       operator<<(float __f)      |                  ~~~~~~^~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:232: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>]'  232 |       operator<<(long double __f)      |       ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:232:30: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'long double'  232 |       operator<<(long double __f)      |                  ~~~~~~~~~~~~^~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:245: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>]'  245 |       operator<<(const void* __p)      |       ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:245:30: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'const void*'  245 |       operator<<(const void* __p)      |                  ~~~~~~~~~~~~^~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:250:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]'  250 |       operator<<(nullptr_t)      |       ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:250:18: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'std::nullptr_t'  250 |       operator<<(nullptr_t)      |                  ^~~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/ostream.tcc:119: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>]'  119 |     basic_ostream<_CharT, _Traits>::      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/ostream.tcc:120:34: note:   no known conversion for argument 1 from 'std::array<int, 1>' to 'std::basic_ostream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'}  120 |     operator<<(__streambuf_type* __sbin)      |                ~~~~~~~~~~~~~~~~~~^~~~~~In file included from /opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/basic_string.h:48,                 from /opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/string:53,                 from /opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/locale_classes.h:40,                 from /opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/ios_base.h:41,                 from /opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ios:4,                 from /opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:38:/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/string_view:672:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'  672 |     operator<<(basic_ostream<_CharT, _Traits>& __os,      |     ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/string_view:672:5: note:   template argument deduction/substitution failed:delete.cpp:3:31: note:   'std::array<int, 1>' is not derived from 'std::basic_string_view<_CharT, _Traits>'    3 | main(){std::cout<<std::array{1};}      |                               ^/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/basic_string.h:3883: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, _Allocator>&)' 3883 |     operator<<(basic_ostream<_CharT, _Traits>& __os,      |     ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/basic_string.h:3883:5:note:   template argument deduction/substitution failed:delete.cpp:3:31: note:   'std::array<int, 1>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'    3 | main(){std::cout<<std::array{1};}      |                               ^In file included from /opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/ios_base.h:46:/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/system_error:279:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'  279 |     operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)      |     ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/system_error:279:5: note:   template argument deduction/substitution failed:delete.cpp:3:24: note:   cannot convert 'std::array<int, 1>{std::__array_traits<int, 1>::_Type{1}}' (type 'std::array<int, 1>') to type 'const std::error_code&'    3 | main(){std::cout<<std::array{1};}      |                        ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:507:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'  507 |     operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)      |     ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:507:5: note:   template argument deduction/substitution failed:delete.cpp:3:31: note:   deduced conflicting types for parameter '_CharT' ('cha' and 'std::array<int, 1>')    3 | main(){std::cout<<std::array{1};}      |                               ^/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:517:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'  517 |     operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)      |     ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:517:5: note:   template argument deduction/substitution failed:delete.cpp:3:24: note:   cannot convert 'std::array<int, 1>{std::__array_traits<int, 1>::_Type{1}}' (type 'std::array<int, 1>') to type 'char'    3 | main(){std::cout<<std::array{1};}      |                        ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:523:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'  523 |     operator<<(basic_ostream<char, _Traits>& __out, char __c)      |     ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:523:5: note:   template argument deduction/substitution failed:delete.cpp:3:24: note:   cannot convert 'std::array<int, 1>{std::__array_traits<int, 1>::_Type{1}}' (type 'std::array<int, 1>') to type 'char'    3 | main(){std::cout<<std::array{1};}      |                        ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:534:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'  534 |     operator<<(basic_ostream<char, _Traits>& __out, signed char __c)      |     ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:534:5: note:   template argument deduction/substitution failed:delete.cpp:3:24: note:   cannot convert 'std::array<int, 1>{std::__array_traits<int, 1>::_Type{1}}' (type 'std::array<int, 1>') to type 'signed char'    3 | main(){std::cout<<std::array{1};}      |                        ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:539:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'  539 |     operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)      |     ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:539:5: note:   template argument deduction/substitution failed:delete.cpp:3:24: note:   cannot convert 'std::array<int, 1>{std::__array_traits<int, 1>::_Type{1}}' (type 'std::array<int, 1>') to type 'unsigned char'    3 | main(){std::cout<<std::array{1};}      |                        ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:598:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'  598 |     operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)      |     ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:598:5: note:   template argument deduction/substitution failed:delete.cpp:3:31: note:   mismatched types 'const _CharT*' and 'std::array<int, 1>'    3 | main(){std::cout<<std::array{1};}      |                               ^/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/ostream.tcc:302:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'  302 |     operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)      |     ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/ostream.tcc:302:5: note:   template argument deduction/substitution failed:delete.cpp:3:24: note:   cannot convert 'std::array<int, 1>{std::__array_traits<int, 1>::_Type{1}}' (type 'std::array<int, 1>') to type 'const char*'    3 | main(){std::cout<<std::array{1};}      |                        ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:615:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'  615 |     operator<<(basic_ostream<char, _Traits>& __out, const char* __s)      |     ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:615:5: note:   template argument deduction/substitution failed:delete.cpp:3:24: note:   cannot convert 'std::array<int, 1>{std::__array_traits<int, 1>::_Type{1}}' (type 'std::array<int, 1>') to type 'const char*'    3 | main(){std::cout<<std::array{1};}      |                        ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:628:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)'  628 |     operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)      |     ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:628:5: note:   template argument deduction/substitution failed:delete.cpp:3:24: note:   cannot convert 'std::array<int, 1>{std::__array_traits<int, 1>::_Type{1}}' (type 'std::array<int, 1>') to type 'const signed char*'    3 | main(){std::cout<<std::array{1};}      |                        ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:633:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)'  633 |     operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)      |     ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:633:5: note:   template argument deduction/substitution failed:delete.cpp:3:24: note:   cannot convert 'std::array<int, 1>{std::__array_traits<int, 1>::_Type{1}}' (type 'std::array<int, 1>') to type 'const unsigned char*'    3 | main(){std::cout<<std::array{1};}      |                        ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:754:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)'  754 |     operator<<(_Ostream&& __os, const _Tp& __x)      |     ^~~~~~~~/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:754:5: note:   template argument deduction/substitution failed:/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_ostream<char>&; _Tp = std::array<int, 1>]':delete.cpp:3:31:   required from here/opt/homebrew/Cellar/gcc@12/12.1.0_1/include/c++/12/ostream:754:5: error: no type named 'type' in 'struct std::enable_if<false, void>'

Another one, just to see what happens when you redefine important functions.

#define write std::array#define memcpy printf#include <iostream>

Compiled with Apple Clang 13.1.6 on macOS 12.4, with no options.

Error (18212 characters):

In file included from delete.cpp:4:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iostream:37:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ios:214:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:15:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:522:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:652:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstring:60:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string.h:60:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:72:7: error: functions that differ only in their return type cannot be overloadedvoid    *memcpy(void *__dst, const void *__src, size_t __n);~~~~~~~~~^delete.cpp:3:16: note: expanded from macro 'memcpy'#define memcpy cout               ^delete.cpp:2:14: note: expanded from macro 'cout'#define cout printf             ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:170:6: note: previous declaration is hereint      printf(const char * __restrict, ...) __printflike(1, 2);~~~      ^In file included from delete.cpp:4:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iostream:37:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ios:214:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:15:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:522:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:653:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:500:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/function.h:22:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:799:23: error: cannot initialize a parameter of type 'const char *' with an rvalue of type 'void *'        _VSTD::memcpy(static_cast<void*>(__end2), static_cast<void const*>(__begin1), _Np * sizeof(_Tp));                      ^~~~~~~~~~~~~~~~~~~~~~~~~~/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:170:36: note: passing argument to parameter hereint      printf(const char * __restrict, ...) __printflike(1, 2);                                       ^In file included from delete.cpp:4:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iostream:38:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/istream:163:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:221:20: error: non-friend class member 'array' cannot have a qualified name    basic_ostream& write(const char_type* __s, streamsize __n);                   ^~~~~delete.cpp:1:20: note: expanded from macro 'write'#define write std::array              ~~~~~^In file included from delete.cpp:4:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iostream:38:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/istream:163:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:905:45: error: unknown type name 'char_type'basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)                                            ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:905:33: error: nested name specifier 'basic_ostream<_CharT, _Traits>::std::' for declaration does not refer into a class, class template or class template partial specializationbasic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~delete.cpp:1:20: note: expanded from macro 'write'#define write std::array                   ^In file included from delete.cpp:4:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iostream:38:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/istream:163:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:911:9: error: unknown type name 'sentry'        sentry __sen(*this);        ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:911:23: error: invalid use of 'this' outside of a non-static member function        sentry __sen(*this);                      ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:912:22: error: use of undeclared identifier '__n'        if (__sen && __n)                     ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:914:17: error: invalid use of 'this' outside of a non-static member function            if (this->rdbuf()->sputn(__s, __n) != __n)                ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:914:38: error: use of undeclared identifier '__s'            if (this->rdbuf()->sputn(__s, __n) != __n)                                     ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:914:43: error: use of undeclared identifier '__n'            if (this->rdbuf()->sputn(__s, __n) != __n)                                          ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:914:51: error: use of undeclared identifier '__n'            if (this->rdbuf()->sputn(__s, __n) != __n)                                                  ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:915:17: error: invalid use of 'this' outside of a non-static member function                this->setstate(ios_base::badbit);                ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:921:9: error: invalid use of 'this' outside of a non-static member function        this->__set_badbit_and_consider_rethrow();        ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:924:13: error: invalid use of 'this' outside of a non-static member function    return *this;            ^In file included from delete.cpp:4:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iostream:55:33: error: declaration conflicts with target of using declaration already in scopeextern _LIBCPP_FUNC_VIS ostream cout;                                ^delete.cpp:2:14: note: expanded from macro 'cout'#define cout printf             ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:170:6: note: target of using declarationint      printf(const char * __restrict, ...) __printflike(1, 2);         ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstdio:169:9: note: using declarationusing ::printf _LIBCPP_USING_IF_EXISTS;        ^In file included from delete.cpp:4:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iostream:37:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ios:214:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:15:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:522:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:653:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:500:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/function.h:20:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:25:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:15:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/hash.h:40:19: error: cannot initialize a parameter of type 'const char *' with an rvalue of type 'unsigned int *'    _VSTD::memcpy(&__r, __p, sizeof(__r));                  ^~~~/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/hash.h:138:28: note: in instantiation of function template specialization 'std::__loadword<unsigned int>' requested here      const uint32_t __a = __loadword<uint32_t>(__s);                           ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/hash.h:229:14: note: in instantiation of member function 'std::__murmur2_or_cityhash<unsigned long, 64>::__hash_len_0_to_16' requested here      return __hash_len_0_to_16(__s, __len);             ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/hash.h:347:16: note: in instantiation of member function 'std::__murmur2_or_cityhash<unsigned long, 64>::operator()' requested here        return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));               ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/hash.h:421:20: note: in instantiation of member function 'std::__scalar_hash<std::_PairT, 2>::operator()' requested here    return _HashT()(__p);                   ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:170:36: note: passing argument to parameter hereint      printf(const char * __restrict, ...) __printflike(1, 2);                                       ^In file included from delete.cpp:4:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iostream:37:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ios:214:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:15:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:522:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:653:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:500:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/function.h:20:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:25:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:15:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/hash.h:40:19: error: cannot initialize a parameter of type 'const char *' with an rvalue of type 'unsigned long *'    _VSTD::memcpy(&__r, __p, sizeof(__r));                  ^~~~/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/hash.h:239:15: note: in instantiation of function template specialization 'std::__loadword<unsigned long>' requested here  _Size __x = __loadword<_Size>(__s + __len - 40);              ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/hash.h:347:16: note: in instantiation of member function 'std::__murmur2_or_cityhash<unsigned long, 64>::operator()' requested here        return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));               ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/hash.h:421:20: note: in instantiation of member function 'std::__scalar_hash<std::_PairT, 2>::operator()' requested here    return _HashT()(__p);                   ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:170:36: note: passing argument to parameter hereint      printf(const char * __restrict, ...) __printflike(1, 2);                                       ^In file included from delete.cpp:4:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iostream:37:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ios:214:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:15:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:522:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:653:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:500:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/function.h:20:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:25:In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:15:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/hash.h:185:42: error: no matching function for call to '__loadword'    return __weak_hash_len_32_with_seeds(__loadword<_Size>(__s),                                         ^~~~~~~~~~~~~~~~~/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/hash.h:244:28: note: in instantiation of member function 'std::__murmur2_or_cityhash<unsigned long, 64>::__weak_hash_len_32_with_seeds' requested here  pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z);                           ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/hash.h:347:16: note: in instantiation of member function 'std::__murmur2_or_cityhash<unsigned long, 64>::operator()' requested here        return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));               ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/hash.h:421:20: note: in instantiation of member function 'std::__scalar_hash<std::_PairT, 2>::operator()' requested here    return _HashT()(__p);                   ^/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/hash.h:37:1: note: candidate template ignored: substitution failure [with _Size = unsigned long]__loadword(const void* __p)^fatal error: too many errors emitted, stopping now [-ferror-limit=]20 errors generated.

Viewing all articles
Browse latest Browse all 24

Trending Articles