[Bug c++/110655] New: incorrect position of indicator in error message
drepper.fsp+rhbz at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jul 13 11:07:19 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110655
Bug ID: 110655
Summary: incorrect position of indicator in error message
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: drepper.fsp+rhbz at gmail dot com
Target Milestone: ---
Take this source and run it through a trunk version or earlier of the C++
frontend.
#include <stdio.h>
int main() {
puts(“hello world”);
return 0;
}
This is the same code as in BZ 110654 but shows a different, frontend-specific
problem.
The output is:
u.c:3:8: error: extended character “ is not valid in an identifier
3 | puts(“hello world”);
| ^
u.c:3:15: error: extended character ” is not valid in an identifier
3 | puts(“hello world”);
| ^
u.c: In function ‘int main()’:
u.c:3:8: error: ‘“hello’ was not declared in this scope
3 | puts(“hello world”);
| ^~~~~~
The problem is the second error message. It should report the U201d character
at what would be the end of the string but it column indicator points to the
second word in the string.
If you want to go further down the rathole of this example, the first error
message says that U201c is not valid in an identifer which is of course
correct. But then gcc neverthess adds it in front of the supposed identifier
which extends to the end of the first word of the string. See the last error
message which says that “hello is not a valid identifier. This is
inconsistent.
More information about the Gcc-bugs
mailing list