[Issue 17897] New:  Зostbit is not called for temporary structures in the function parameters
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Fri Oct 13 12:08:31 UTC 2017
    
    
  
https://issues.dlang.org/show_bug.cgi?id=17897
          Issue ID: 17897
           Summary: Зostbit is not called for temporary structures in the
                    function parameters
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: japplegame at gmail.com
Test case:
import std.stdio;
struct Foo {
    this(int) {}
    ~this() {}
}
struct Bar {
    this(this) {
        writefln("Bar.this(this): %X", &this);
    }
    this(Foo, Foo) {
        writefln("Bar.this(int): %X", &this);
    }
    ~this() {
        writefln("Bar.~this(): %X", &this);
    }
}
void fun(Bar n) {
    writefln("fun: %X", &n);
}
void main() {
    Foo foo;
    fun(Bar(foo, Foo(0)));
}
Result:
Bar.this(int): XXXXXXXXXXXX
fun: XXXXXXXXXXXX
Bar.~this(): XXXXXXXXXXXX
Bar.~this(): XXXXXXXXXXXX
Expected:
Bar.this(int): XXXXXXXXXXXX
Bar.this(this): XXXXXXXXXXXX
fun: XXXXXXXXXXXX
Bar.~this(): XXXXXXXXXXXX
Bar.~this(): XXXXXXXXXXXX
Discussion: https://forum.dlang.org/post/tvzwzrpwadobzsxcalxy@forum.dlang.org
--
    
    
More information about the Digitalmars-d-bugs
mailing list