https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120421

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Harald van Dijk from comment #3)
> For diagnostics, this is not an exact duplicate, this can be addressed while
> keeping the column information that is generated today. Here's what Clang
> does for this same test:
> 
> $ clang++ -c a.cc
> a.cc:7:6: error: use of undeclared identifier 'xxxxx'
>     7 |         fcn(xxxxx);  // comment
>       |             ^
> 1 error generated.
> $ clang++ -c a.cc -save-temps
> a.cc:7:14: error: use of undeclared identifier 'xxxxx'
>     7 |  longNamefcn(xxxxx);
>       |              ^
> 1 error generated.
> 
> That is, although Clang has the same issue that the source column
> information is completely lost, the column information is that from the
> preprocessed output, it still manages to generate a good diagnostic by
> printing the preprocessed line instead.

But printing out the preprocessed line is equally as wrong in many cases.
Especially when it comes to `#line` markers. That is it is there is no correct
answer and clang can be shown to be broken too in some cases too.

Reply via email to