[Issue 12496] __traits(parent, x) returns incorrect type

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Aug 22 23:04:35 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=12496

--- Comment #3 from Mike <slavo5150 at yahoo.com> ---
A better example:

module test;

import std.stdio;

final abstract class T1 
{
  final abstract class C(uint value)
  {
    static uint getValue() 
    {
      return value;
    }
  }

  alias Child = C!2;
}

final abstract class T2
{
  final abstract class Child
  {
    static uint getValue() 
    {
      return 2;
    }
  }
}

void main()
{
  writeln(__traits(parent, T1.Child).stringof);   // this should be T1
  writeln(__traits(parent, T2.Child).stringof);   // this should be, and is, T2
}

--


More information about the Digitalmars-d-bugs mailing list