https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71282
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |msebor at gcc dot gnu.org Resolution|--- |INVALID --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Unlike in C, in C++ there are two overloads of strpbrk (declared by GLIBC on GNU/Linux): const char* strpbrk (const char*, const char*); and char* strpbrk (char*, const char*); The first one is used when the first argument is a const pointer and array, as in the test case, and the second one otherwise. Since the first one returns a const char* which is not convertible to char*, the program is incorrect. Unfortunately, the caret in the error makes this hard to see. Current trunk does only slightly better: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive] char *pSpc = strpbrk(tstStr, " "); ~~~~~~~^~~~~~~~~~~~~ That might be worth raising a separate bug for (if one doesn't already exist), but this one is invalid.