Questionable 1.1 C++ parsing
Carlo Wood
carlo@runaway.xs4all.nl
Fri Sep 18 02:04:00 GMT 1998
| // Build don't link:
| // Based on a test case by Phil Blecker <tmwg@inxservices.com>
|
| int foo(int);
| int bar() {
| int baz(int(foo(bar())));
| int foo = baz;
| }
int foo(int);
void bar() {
int baz(int(foo(3)));
int foo = baz;
}
Gives the same error, and is slightly less complex.
The following might help in finding the bug(?)
int foo(void);
void bar() {
int baz(int(foo()));
int foo = baz;
}
Gives:
~/tmp>g++ -c baz.cc
baz.cc: In function `void bar()':
baz.cc:4: warning: initialization to `int' from `int (*)(int (*)())' lacks a cast
While
int foo(void);
void bar() {
int baz((int(foo())));
int foo = baz;
}
compiles fine (note the extra () around the initialisation value of baz).
--
Carlo Wood <carlo@runaway.xs4all.nl>
More information about the Gcc
mailing list