[Issue 19782] New: `alias this` appends `null` instead of inner/aliased element to array
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sun Mar 31 18:40:06 UTC 2019
    
    
  
https://issues.dlang.org/show_bug.cgi?id=19782
          Issue ID: 19782
           Summary: `alias this` appends `null` instead of inner/aliased
                    element to array
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: m.rodacki at gmx.de
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
-----
--
    
    
More information about the Digitalmars-d-bugs
mailing list