snazzy-d / sdc

The Snazzy D Compiler
MIT License
249 stars 55 forks source link

Scope(exit) allows return #115

Open deadalnix opened 9 years ago

deadalnix commented 9 years ago

From @schancel on October 3, 2014 3:29

See test0120, which currently passes.

Copied from original issue: deadalnix/libd#29

deadalnix commented 9 years ago

It is illegal now ?

deadalnix commented 9 years ago

Also please post minimal sample code to repro the issue when doing a bug report, otherwize things become quickly untractable.

deadalnix commented 9 years ago

From @schancel on October 3, 2014 3:43

Yes, see the last paragraph of http://dlang.org/statement.html#ScopeGuardStatement

Minimal code:

int main() {
    scope(exit) return -1;
    return 0;
}

dmd produces: testie.d(2): Error: return statements cannot be in scope(exit) bodies

deadalnix commented 9 years ago

Well that is new, it was allowed when I implemented this. Anyway, I don't think this is very important. It need to be addressed at some point, but me must focus on high impact changes.

deadalnix commented 9 years ago

From @UplinkCoder on October 3, 2014 8:42

@deadalnix @schancel maybe we could do some kind of TODO, in the wiki or so. Opening so much issues is a bit irritating. I just made a small ugly TODO page for the wiki please add stuff @schancel