This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Questionable 1.1 C++ parsing
- To: oliva at dcc dot unicamp dot br (Alexandre Oliva)
- Subject: Re: Questionable 1.1 C++ parsing
- From: Carlo Wood <carlo at runaway dot xs4all dot nl>
- Date: Thu, 17 Sep 1998 16:57:29 +0200 (CEST)
- Cc: egcs at cygnus dot com (egcs at cygnus dot com)
| // 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>