This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Static nested functions
"Joseph S. Myers" <joseph@codesourcery.com> writes:
> Yes, it's a list of appropriate tests. I can write the tests (minus the
> diagnostics which may depend on the exact patch; the point of the tests
> being that certain errors are detected and do not cause a crash, the exact
> errors following the first one not being so important).
>
What I've got now is the following attached testcases. When I get something
that doesn't ICE on all the testcases I'll be happy.
--
Thanks,
Jim
http://www.student.cs.uwaterloo.ca/~ja2morri/
http://phython.blogspot.com
http://open.nit.ca/wiki/?page=jim
/* { dg-do compile } */
/* { dg-options "" } */
void
flarm(void)
{
static void foo(); /* { dg-error "invalid storage class" } */
static void bar(); /* { dg-error "invalid storage class" } */
foo();
}
static void
bar (int i)
{
}
static void
foo(void)
{
}
/* { dg-do compile } */
/* { dg-options "" } */
register int h ()
{ /* { dg-error "invalid storage class" } */
return 1;
}
int f(int i)
{
static int g(); /* { dg-error "invalid storage class" } */
static int g() { /* { dg-error "invalid storage class" } */
return i;
}
return g();
}
int k(int i)
{
static int g(); /* { dg-error "invalid storage class" } */
int g() {
return i;
}
return g();
}
int l(int i)
{
auto int g();
static int g() { /* { dg-error "invalid storage class" } */
return i;
}
return g();
}
/* { dg-do compile } */
/* { dg-options "" } */
static int barf ();
int foo ()
{
static int bar (); /* { dg-error "invalid storage class" } */
extern int baz ();
auto int bar();
auto int barf ();
int j = 4;
int bar() {
return j;
}
int barf() {
return j;
}
return bar ();
}
static int barf () {
return 3;
}