This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
C++ compile -vs- errors in structure definition
- To: Gcc Bug List <bug-gcc at gnu dot org>
- Subject: C++ compile -vs- errors in structure definition
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 20 Jan 2000 08:56:13 -0700
- Reply-To: tromey at cygnus dot com
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