C++ compile -vs- errors in structure definition
Tom Tromey
tromey@cygnus.com
Thu Jan 20 07:54:00 GMT 2000
I'm using a fairly recent (last couple of weeks) g++ from the cvs
repository (head branch).
Consider this incorrect program:
================================================================
typedef int (*fptr) (void);
extern int func1 (void);
extern int func2 (int);
struct ts
{
fptr one;
fptr two;
};
ts the_ts =
{
func2,
func1
};
================================================================
If I compile this, I expect to get an error about the use of `func2'
in the `the_ts' structure. I do get such an error, but the line
number is wrong:
creche. g++ -fsyntax-only foo.cc
foo.cc:16: cannot convert `int (*) (int)' to `int (*) ()' in initialization
I expect line 14 and not 16.
If I have a very large structure (for instance, the structure used for
JNI has something like 100 function pointers in it), it becomes very
hard to find the actual incorrect line.
Tom
More information about the Gcc-bugs
mailing list