Bug 7230 – Crash during printing anonymous union with writeln family functions.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2012-01-05T02:28:00Z
Last change time
2012-03-25T03:18:02Z
Keywords
patch
Assigned to
nobody
Creator
luk.wrzosek

Attachments

IDFilenameSummaryContent-TypeSize
1068bug7230.dbug test casetext/x-dsrc157

Comments

Comment #0 by luk.wrzosek — 2012-01-05T02:28:54Z
writeln is not aware of anonymous unions inside of structs (probably classes too). The attached file crashes when run.
Comment #1 by luk.wrzosek — 2012-01-05T02:30:33Z
Created attachment 1068 bug test case
Comment #2 by bearophile_hugs — 2012-01-05T02:38:21Z
Code copied here to increase its visibility: import std.stdio; struct Bug7230 { union { string a; int b; } } void main() { Bug7230 bug; bug.b = 123; writeln(bug); }
Comment #3 by k.hara.pg — 2012-01-06T12:36:45Z
https://github.com/D-Programming-Language/phobos/pull/383 The format implemented the patch is not yet determined. Please comment your opinion.
Comment #4 by bearophile_hugs — 2012-01-06T13:31:11Z
(In reply to comment #3) > https://github.com/D-Programming-Language/phobos/pull/383 > > The format implemented the patch is not yet determined. > Please comment your opinion. Thank you for improving writeln. Maybe the string tag "union" is better than "overlap": Bug7230("hello", #{union a, b, c}, 10)
Comment #5 by k.hara.pg — 2012-02-10T06:30:36Z
Comment #6 by k.hara.pg — 2012-03-25T03:18:02Z
*** Issue 7324 has been marked as a duplicate of this issue. ***