This is the mail archive of the
mailing list for the GCC project.
A bug with variables and functions of the same name?
- From: darby johnston <darbyjohnston at yahoo dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 27 Nov 2006 17:35:56 -0800 (PST)
- Subject: A bug with variables and functions of the same name?
Found something sort of odd:
int main(int, char **)
int a = a(100);
> 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
ok). 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?
gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
Thanks for any help!