Bug 9912 – Wrong codegen when using tuple over member variable in more than one method
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-09T07:36:00Z
Last change time
2013-11-22T07:40:56Z
Assigned to
nobody
Creator
ibuclaw
Comments
Comment #0 by ibuclaw — 2013-04-09T07:36:38Z
GDC bug report:
http://bugzilla.gdcproject.org/show_bug.cgi?id=49
LDC bug report:
https://github.com/ldc-developers/ldc/issues/266
Minimal testcase:
---
template Tuple(Stuff ...) {
alias Stuff Tuple;
}
struct S {
int i;
alias Tuple!i t;
void a() {
auto x = t;
}
void b() {
auto x = t;
}
}
---
Causes an ICE in gdc and ldc because the dotvar expression 'this.i' is cached and re-used when building the tuple expression in both methods 'a' and 'b'. Meaning that both uses of 'this' is given the parent context of method 'a'.
This is a problem when you try to access the 'this' parameter of 'a' from the function 'b'... Oops, you can't do that!
Problem is in the D frontend, and should be fixed.