Bug 19782 – `alias this` appends `null` instead of inner/aliased element to array
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-03-31T18:40:06Z
Last change time
2019-04-03T12:33:50Z
Keywords
pull
Assigned to
No Owner
Creator
Michael Rodacki
Comments
Comment #0 by m.rodacki — 2019-03-31T18:40:06Z
import std.stdio;
class Inner {}
class Outer {
Inner inner; alias inner this;
this(Inner i) { inner = i; }
}
void main() {
Inner[] inners = [];
inners ~= new Inner;
inners ~= new Outer(new Inner); // Appends null
foreach(inner; inners){
writeln(">> ", inner);
}
}
---
Output from https://run.dlang.io/ with all dmd compilers:
Up to 2.083.1: Success with output:
-----
>> onlineapp.Inner
>> onlineapp.Inner
-----
Since 2.084.0: Success with output:
-----
>> onlineapp.Inner
>> null
-----
Comment #1 by dlang-bot — 2019-04-03T10:39:24Z
@RazvanN7 created dlang/dmd pull request #9550 "Fix Issue 19782 - alias this appends null instead of inner/aliased element to array" fixing this issue:
- Fix Issue 19782 - alias this appends null instead of inner/aliased element to array
https://github.com/dlang/dmd/pull/9550
Comment #2 by dlang-bot — 2019-04-03T12:33:50Z
dlang/dmd pull request #9550 "Fix Issue 19782 - alias this appends null instead of inner/aliased element to array" was merged into master:
- 520e5fc638319273de0514706cd87045d13e7d81 by RazvanN7:
Fix Issue 19782 - alias this appends null instead of inner/aliased element to array
https://github.com/dlang/dmd/pull/9550