This is the mail archive of the
mailing list for the GCC project.
Re: A bug with variables and functions of the same name?
- From: Ian Lance Taylor <iant at google dot com>
- To: darby johnston <darbyjohnston at yahoo dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 27 Nov 2006 19:53:24 -0800
- Subject: Re: A bug with variables and functions of the same name?
- References: <email@example.com>
darby johnston <firstname.lastname@example.org> writes:
> int a(int);
> int main(int, char **)
> int a = a(100);
> return 0;
> > g++ -Wall -o foo foo.cxx
> foo.cxx: In function Âint main(int, char**)Â:
> foo.cxx:7: error: ÂaÂ cannot be used as a function
> That seems normal, but add a "const" to the above:
> const int a = a(100);
> And it compiles without any errors (and even links
That seems like a bug. Fortunately it seems to be fixed in the
upcoming 4.2 release.
> I made this simple test case from a bug I found
> in my code, which even stranger, emitted warnings
> warning: Âretval.170Â is used uninitialized in this
> Of course, I don't have any variables named
> "retval.170". Is this a bug with gcc?
These errors messages also should be better in 4.2.