Skip to content

scope(exit) should not be allowed in the main scope of noreturn functions #5461

Open
@dlangBugzillaToGithub

Description

@dlangBugzillaToGithub

basile-z reported this on 2024-03-29T07:08:11Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=24466

CC List

Description

consider the following code

```d
noreturn v(int a)
{
    scope(exit) a++; // cant be executed    
    {
        scope(exit) a++; // this one is okay
    }
    assert(0);
}
```

There should be a sema error for the first scope guard as the defered expression statement cannot be executed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions