Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

about 3 years ago

Language

C++

Compiler

gcc 11.1.0

Options
Warnings
Boost 1.79.0
C++17
no pedantic

Author

anonymous

about 3 years ago

$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.79.0-gcc-11.1.0/include -std=c++17
prog.cc: In function 'int main()':
prog.cc:9:7: error: no matching function for call to 'func(const char* const&)'
    9 |   func(s);  // error
      |   ~~~~^~~
prog.cc:3:29: note: candidate: 'template<long unsigned int size> void func(const char (&)[size])'
    3 | template <size_t size> void func(const char (&)[size]) {}
      |                             ^~~~
prog.cc:3:29: note:   template argument deduction/substitution failed:
prog.cc:9:7: note:   mismatched types 'const char [size]' and 'const char* const'
    9 |   func(s);  // error
      |   ~~~~^~~
prog.cc:5:6: note: candidate: 'void func(const char*&)' (near match)
    5 | void func(const char *&) {}
      |      ^~~~
prog.cc:5:6: note:   conversion of argument 1 would be ill-formed:
prog.cc:9:8: error: binding reference of type 'const char*&' to 'const char* const' discards qualifiers
    9 |   func(s);  // error
      |        ^
Exit Code:
1