[Bug c++/56723] New: wrong location in error message

tromey at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 25 18:40:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56723

             Bug #: 56723
           Summary: wrong location in error message
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tromey@gcc.gnu.org


Consider this source file:

int f (int *);

int callf (int, int, int (*)(double *));

int docall(void)
{
  return callf (23, 72,
        f);
}


Compiling this with g++ yields:

t.cc: In function ‘int docall()’:
t.cc:8:4: error: invalid conversion from ‘int (*)(int*)’ to ‘int (*)(double*)’
[-fpermissive]
   f);
    ^
t.cc:3:5: error:   initializing argument 3 of ‘int callf(int, int, int
(*)(double*))’ [-fpermissive]
 int callf (int, int, int (*)(double *));
     ^


Note that "8:4" location.
I think this is slightly off.

The C compiler gets it ok:

barimba. gcc -g --syntax-only t.c
t.c: In function ‘docall’:
t.c:8:3: warning: passing argument 3 of ‘callf’ from incompatible pointer type
[enabled by default]
(etc)


More information about the Gcc-bugs mailing list