When I call a function via a function pointer, then the error message does not
specify which argument contains an error.  Consider the code

typedef void (* subptr) (int * x, void ** y);

void call (subptr sub, int a, int * b)
{
  (* sub) (a, b);
}

when compiled, then I receive the errors

$ ~/gcc/bin/g++ --version
g++ (GCC) 4.3.0 20070201 (experimental)
$ ~/gcc/bin/g++ -c argerror.cc
argerror.cc: In function ‘void call(void (*)(int*, void**), int, int*)’:
argerror.cc:5: error: invalid conversion from ‘int’ to ‘int*’
argerror.cc:5: error: cannot convert ‘int*’ to ‘void**’ in argument passing

Note that the first error does not specify that it appears in the first
function argument, and the second error only says "in argument passing", not
"in the second argument".  None of the errors say that the function *sub is
called.


-- 
           Summary: Unclear error message when callling via a function
                    pointer
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schnetter at aei dot mpg dot de
 GCC build triplet: i386-apple-darwin8.8.1
  GCC host triplet: i386-apple-darwin8.8.1
GCC target triplet: i386-apple-darwin8.8.1


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

Reply via email to