Bug 8360 – Destruction of uninitialized temporary struct with assert

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-07-08T06:39:00Z
Last change time
2013-10-05T00:17:11Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
code

Attachments

IDFilenameSummaryContent-TypeSize
1123repro.drepro caseapplication/x-octet-stream389

Comments

Comment #0 by code — 2012-07-08T06:39:10Z
Created attachment 1123 repro case When a temporary struct is used as the second argument to assert, and the assert is false, the temporary struct gets destructed despite the fact that it was never actually constructed. See attached repro case. Tested with dmd 2.058 and dmd.2059
Comment #1 by bearophile_hugs — 2012-07-08T07:03:05Z
See also probably related Issue 8361
Comment #2 by k.hara.pg — 2013-10-02T20:46:00Z
Comment #3 by github-bugzilla — 2013-10-05T00:16:51Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/f2d4350dc3d00a454a9e1619484404da75bec7be fix Issue 8360 - Destruction of uninitialized temporary struct with assert https://github.com/D-Programming-Language/dmd/commit/10b704a7d6fe04b597b0c99e537be4960cba270f Merge pull request #2620 from 9rnsr/fix8360 Issue 8360 & 8361 - Destruction of uninitialized temporary struct with assert