[Bug c++/95639] New: wrong error location

f.heckenbach@fh-soft.de gcc-bugzilla@gcc.gnu.org
Thu Jun 11 13:01:41 GMT 2020


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

            Bug ID: 95639
           Summary: wrong error location
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: f.heckenbach@fh-soft.de
  Target Milestone: ---

This may be similar to #93979, but I'm not sure.

% cat test.cpp
#define S(A) sizeof (A)

int main ()
{
  int a[10];
  return (int) S (a);
}
% g++ -Wold-style-cast test.cpp
t.cpp: In function 'int main()':
t.cpp:1:23: warning: use of old-style cast to 'int' [-Wold-style-cast]
    1 | #define S(A) sizeof (A)
      |                       ^
t.cpp:6:16: note: in expansion of macro 'S'
    6 |   return (int) S (a);
      |                ^

The warning itself is correct, but the location and the note point at the
macro, while the offending cast is in main.


More information about the Gcc-bugs mailing list