This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Static nested functions
- From: ja2morri at csclub dot uwaterloo dot ca (James A. Morrison)
- To: gcc at gcc dot gnu dot org
- Date: 01 Dec 2004 02:12:43 -0500
- Subject: Static nested functions
Hi,
I'm looking at 18596 again because my fix didn't do what I expected (it does
nothing). Anyway, we have in gcc.dg/funcdec-storage-1.c the following
void
flarm(void)
{
static void foo(); /* { dg-error "invalid storage class" } */
foo();
}
Should foo () be considered a static function at the file level or a nested
function at the function level. If we consider foo() to be at the file level
then we can be done with this function. If we consider foo() to be a nested
function we then discover that foo() is undefined at the end of the function
and run into PR17807. The nice part about considering foo() to be a nested
function is that in c-decl.c:grokdeclarator() we can turn the storage class of
foo() from static to auto which fixes the ICE in 18596. However we look at
this we are in an error case, but we should do something sane.
--
Thanks,
Jim
http://www.student.cs.uwaterloo.ca/~ja2morri/
http://phython.blogspot.com
http://open.nit.ca/wiki/?page=jim