https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87504
Bug ID: 87504 Summary: inconsistent diagnostic style between C and C++ Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- I noticed an improvement in the diagnostic GCC issues for the following test case (where I made a typo in the first argument to strlnen: a&a[v0]). $ cat c.c && gcc -O2 -S -fdump-tree-optimized=/dev/stdout c.c const char a[] = "12345"; int v0 = 0; int f (unsigned n) { if (n < 6) n = 6; return __builtin_strnlen (a&a[v0], n); } c.c: In function ‘f’: c.c:10:30: error: invalid operands to binary & (have ‘const char *’ and ‘int’) 10 | return __builtin_strnlen (a&a[v0], n); | ~^~~~~~ | | | | | char | const char * But when testing the same code with G++ I also noticed the message is slightly different: c.c: In function ‘int f(unsigned int)’: c.c:10:30: error: invalid operands of types ‘const char [6]’ and ‘const char’ to binary ‘operator&’ 10 | return __builtin_strnlen (a&a[v0], n); | ~^~~~~~ It would be nice to converge on the same format and phrasing of the diagnostic between the two languages. FWIW, although I like how the C message distinguishes the operands from the operator using different colors rendering each of the operands in its own color seems somewhat distracting (it raises the question: do the colors suggest some subtlety of the error that's not captured in the text?) I also find the C++ phrasing more readable than the C style with the "(have ‘const char *’ and ‘int’)".