On Mon, 18 Feb 2013 20:59:37 -0500, Nick Sabalausky <[email protected]> wrote:

Consider these nested switches:

---------------------------
enum Foo {a, b}
enum Bar {bar}

auto foo = Foo.a;
auto bar = Bar.bar;

final switch(foo)
{
case Foo.a:
    final switch(bar)
    {
    case Bar.bar:
        XXXXXX
        break;
    }
    break;

case Foo.b:
    break;
}
---------------------------

Without adding extra code anywhere else, is there anything I can stick
in for XXXXXX to get execution to jump to "case Foo.b:"?

Doing "goto case Foo.b;" doesn't work. It just gives a compile error
that a Foo can't be implicitly converted to Bar.

This ability isn't critical, of course, but it would help clean up some
code I have.


Hm.. wouldn't plain goto work:

final switch(foo)
{
case Foo.a:
    final switch(bar)
    {
    case Bar.bar:
        goto HORRIBLE_HACK;
        break;
    }
    break;

case Foo.b:
HORRIBLE_HACK:
    break;
}

Not sure, didn't test.

-Steve

Reply via email to