https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85958
Bug ID: 85958 Summary: Make const qualifier error clear Product: gcc Version: 8.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jg at jguk dot org Target Milestone: --- Calling a function with a const int seems to give such an obscure message, can it be made clearer? output: $ g++ -o main main.cpp -Wall -Werror -Wconversion main.cpp: In function ‘int main()’: main.cpp:11:25: error: binding ‘const int’ to reference of type ‘int&’ discards qualifiers strstripspace(unused); ^ main.cpp:5:6: note: initializing argument 1 of ‘void strstripspace(int&)’ void strstripspace(int & value); Expected something clearer: $ g++ -o main main.cpp -Wall -Werror -Wconversion main.cpp: In function ‘int main()’: main.cpp:11:25: error: passing ‘const int’ as reference of type ‘int&’ discards qualifier const strstripspace(unused); ^ main.cpp:5:6: note: initializing argument 1 of ‘void strstripspace(int&)’ void strstripspace(int & value); /* g++ -o main main.cpp -Wall -Werror -Wconversion */ #include <string> void strstripspace(int & value) { return; } int main() { const int unused = 0; strstripspace(unused); return 0; }