https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95596
--- Comment #1 from bzsurr at protonmail dot com --- (In reply to bzsurr from comment #0) > Looking at the following code gcc calls the _char*_ overload, according to > the standard the string literal is of type const array of char, so the non > const char pointer should not be part of the overload set. > > #include <cstdio> > #include <string> > void foo(char*) { puts("char*"); } > void foo(std::string) { puts("std::string"); } > int main() > { > foo("Hello World"); > } > > > Compiler Explorer Link: > https://godbolt.org/z/82D4LT Compiler output: <source>: In function 'int main()': <source>:9:9: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 9 | foo("Hello World"); | ^~~~~~~~~~~~~