D issues are now
tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Summary: |
[CTFE] recursive ref parameters evaluated incorrectly |
Product: |
D
|
Reporter: |
Don <clugdbug> |
Component: |
dmd | Assignee: |
No Owner <nobody> |
Status: |
RESOLVED
FIXED
|
Severity: |
normal
|
CC: |
bugzilla
|
Priority: |
P2
|
Keywords: |
wrong-code |
Version: |
D2 |
Hardware: |
Other |
OS: |
Windows |
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);