On Sunday, 17 June 2018 at 10:58:29 UTC, Cauterite wrote:

---

// main.d
void main() {
        scope(success) {}
}

dmd -betterC main.d
Error: Cannot use try-catch statements with -betterC

---

You can see what the compiler is doing at https://run.dlang.io/is/5BZOQV and clicking on the "AST" button. It produces the following:

import object;
void main()
{
        bool __os2 = false;
        try
        {
        }
        catch(Throwable __o3)
        {
                __os2 = true;
                throw __o3;
        }
        if (!__os2)
        {
        }
        return 0;
}

The compiler could probably lower that to something more intelligent so it could be used in -betterC. I rule it a bug.

Mike


Reply via email to