https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95596
Bug ID: 95596 Summary: string literal wrong overload resolution (char* vs std::string) Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bzsurr at protonmail dot com Target Milestone: --- 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