D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6037 - [CTFE] recursive ref parameters evaluated incorrectly
Summary: [CTFE] recursive ref parameters evaluated incorrectly
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2011-05-19 12:33 UTC by Don
Modified: 2015-06-09 05:11 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Don 2011-05-19 12:33:11 UTC
To fix this, CTFE will need to properly implement a stack for variables to be stored on.
-------------
void bug6037(ref int x, bool b){
    int w = 3;
    if (b) {
        bug6037(w, false);
        assert(w==6);
    } else {
        x = 6;
        assert(w==3); // fails
    }        
}

int bug6037outer(){
    int q;
    bug6037(q, true);
    return 401;
}
static assert(bug6037outer() == 401);