September 13, 2018 [Issue 19244] New: betterC function return struct calling dtor (or not calling postblit) | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19244 Issue ID: 19244 Summary: betterC function return struct calling dtor (or not calling postblit) Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: patric.dexheimer@gmail.com //flags: -betterC import core.stdc.stdio; struct T { this() { printf("postblit\n") } //not called ~this() { printf("dtor\n"); } //called twice } auto build() { T t; return t; } extern(C): void main() { auto x = build; } //output: //dtor //dtor //without -betterC dtor is called once; -- |
Copyright © 1999-2021 by the D Language Foundation