Statement scoping issue

C99 scoping seems to work apart from this, whose return b is invalid
as there is no "b" in scope:

int f (int z)
{
   if (z > sizeof (enum {a, b}))
      return a;
   return b;
}

Neil.

Hi Neil,

I checked in the infrastructure for handling this (separating the concept of a variable scope from the concept of a break/continue scope), but haven't made the behavior change requested yet. Can you please take a look at it?

Thanks,

-Chris

Neil Booth wrote:-

C99 scoping seems to work apart from this, whose return b is invalid
as there is no "b" in scope:

int f (int z)
{
   if (z > sizeof (enum {a, b}))
      return a;
   return b;
}

Fixed below.

Neil.

diff (3.64 KB)

Very nice Neil, thanks!

-Chris