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.
Comment #1 by ibuclaw — 2013-04-10T02:45:43Z
Comment #2 by github-bugzilla — 2013-04-16T12:14:14Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/85e850bf5697a791e07e7020070d5e705dea1b9d fix Issue 9912 - Wrong codegen when using tuple over member variable in more than one method https://github.com/D-Programming-Language/dmd/commit/73835a8be072a3e9dd18778e6f0c6a31d636563f Merge pull request #1881 from 9rnsr/fix9912 Issue 9912 - Wrong codegen when using tuple over member variable in more than one method
Comment #3 by yebblies — 2013-11-22T07:40:56Z
Appears fixed