D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3236 - Postblit called but no matching destructor
Summary: Postblit called but no matching destructor
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All Windows
: P2 critical
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2009-08-08 12:04 UTC by Bartosz Milewski
Modified: 2015-06-09 01:26 UTC (History)
1 user (show)

See Also:


Attachments
Test case for incorrect reference counting (1.76 KB, application/octet-stream)
2009-08-08 12:04 UTC, Bartosz Milewski
Details

Note You need to log in before you can comment on or make changes to this issue.
Description Bartosz Milewski 2009-08-08 12:04:27 UTC
Created attachment 438 [details]
Test case for incorrect reference counting

RcName is a struct that defines postblit, this(this), in order to implement reference counting. When I store the result of a call and then return it:
  RcName rc = create();
  return rc;
I get the right reference count. But if I return directly:
  return create();
postblit is called (increasing ref count), but the destructor is not, so I end up with ref count that is too big
Comment 1 Walter Bright 2009-09-03 13:43:53 UTC
Fixed dmd 2.032