Bug 5859 – Declaration inside if condition doesn't call destructor

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-04-18T20:31:00Z
Last change time
2011-06-04T11:40:23Z
Assigned to
nobody
Creator
k.hara.pg

Attachments

IDFilenameSummaryContent-TypeSize
947test.dtest cases.application/octet-stream2253

Comments

Comment #0 by k.hara.pg — 2011-04-18T20:31:44Z
Test code: ---- import std.stdio; struct S { ~this(){ writeln("S.dtor"); } bool opCast(T:bool)(){ return true; } } void main() { if (auto s = S()) { // s.~this is not called. } else assert(0); } ----
Comment #1 by k.hara.pg — 2011-04-22T04:17:09Z
Created attachment 947 test cases.
Comment #2 by bugzilla — 2011-06-04T11:40:23Z