Bug 3302 – Sloppy type check in dynamic initialization of struct

Status
RESOLVED
Resolution
DUPLICATE
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2009-09-05T19:14:00Z
Last change time
2015-06-09T01:26:48Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
hskwk

Comments

Comment #0 by hskwk — 2009-09-05T19:14:18Z
struct S { int a; } struct T { real a=2; } T t; S s = t; // no compile-time or runtime error std.stdio.writeln(s.a); // -> 0 Probably this issue is due to excess-optimization. The issue is highly critical because it leave a kind of difficult-to-find problem in the compiled binary. Besides, strong-typed enum work well. enum E { a } enum F { a } E e = F.a; // of course compile-time error! P.S. Is this a duplicate of another reported issue?
Comment #1 by hskwk — 2009-09-05T19:20:39Z
*** This issue has been marked as a duplicate of issue 3259 ***