[Issue 11562] New: Goto into or out of finally block is not caught during semantic

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 20 02:18:36 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11562

           Summary: Goto into or out of finally block is not caught during
                    semantic
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid, pull, wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: yebblies at gmail.com
        ReportedBy: yebblies at gmail.com
            Blocks: 602


--- Comment #0 from yebblies <yebblies at gmail.com> 2013-11-20 21:17:35 EST ---
These should all pass:

// Goto into finally block (forwards)
static assert(!__traits(compiles, (bool b)
{
    if (b) goto label;
    try
    {
    }
    finally
    {
    label: {}
    }
    return 1;
}));

// // Goto into finally block (backwards)
static assert(!__traits(compiles, (bool b)
{
    try
    {
    }
    finally
    {
    label: {}
    }
    if (b) goto label;
    return 1;
}));

// Goto out of finally block (forwards)
static assert(!__traits(compiles, (bool b)
{
    try
    {
    }
    finally
    {
    if (b) goto label;
    }
    label: {}
    return 1;
}));

// // Goto out of finally block (backwards)
static assert(!__traits(compiles, (bool b)
{
    label: {}
    try
    {
    }
    finally
    {
    if (b) goto label;
    }
    return 1;
}));

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list