← Back to index
|
Original Bugzilla link
Bug 19244 – betterC function return struct calling dtor (or not calling postblit)
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2018-09-13T19:59:41Z
Last change time
2018-10-27T23:36:41Z
Keywords
betterC
Assigned to
No Owner
Creator
SrMordred
Comments
Comment #0
by patric.dexheimer — 2018-09-13T19:59:41Z
//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;
Comment #1
by patric.dexheimer — 2018-09-13T22:21:28Z
This seem a little serious for me. Not sure if there is some way around this one.
Comment #2
by patric.dexheimer — 2018-09-17T20:28:50Z
Just found, its the same as
https://issues.dlang.org/show_bug.cgi?id=18457
Comment #3
by iamthewilsonator — 2018-10-27T23:36:41Z
*** This issue has been marked as a duplicate of issue 18457 ***