www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17257] New: Wrong recursive template destructor reflection

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

          Issue ID: 17257
           Summary: Wrong recursive template destructor reflection
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: japplegame gmail.com

Discussion - https://forum.dlang.org/post/vkydqijqsdzrsuvzilha forum.dlang.org

import std.string : format;

struct Bar(E) {
    void fun() {
        pragma(msg, format("fun:   Foo.__xdtor - %s", __traits(hasMember, E,
"__xdtor")));
    }
    ~this() {
        pragma(msg, format("~this:   Foo.__xdtor - %s", __traits(hasMember, E,
"__xdtor")));
    }
}

struct Foo {
    Bar!Foo foo;
    ~this() {}
}

Output:
~this: Foo.__xdtor - false
fun: Foo.__xdtor - true

Expected:
~this: Foo.__xdtor - true
fun: Foo.__xdtor - true

--
Mar 14