Summary: Allow exception in CTFE (patch)
           Product: D
           Version: 2.030
          Platform: x86
        OS/Version: All
            Status: NEW
          Keywords: patch
          Severity: enhancement
          Priority: P2
         Component: DMD

Created an attachment (id=389)
 --> (
Patch (DMD 2.030)

The proposed patch implements support for throw/try/catch/finally in CTFE.
Throw statement is, however, somewhat limited; new expression is not allowed,
except for new Exception("msg").

Example and output:
int thrower(string s)
    // The interpretor emulates throw new Exception("msg")
    throw new Exception("exception " ~ s);
    return 0;

int catcher()
        return thrower("abc");
    catch (Exception e)
        throw e;
    return 0;

enum a = catcher("abc");
test.d(21): Error: uncaught exception from catcher(): "exception abc"
test.d(21): Error: cannot evaluate catcher() at compile time

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to