[Issue 3302] New: Sloppy type check in dynamic initialization of struct
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Sep 5 19:14:20 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3302
Summary: Sloppy type check in dynamic initialization of struct
Product: D
Version: 2.032
Platform: All
OS/Version: All
Status: NEW
Keywords: accepts-invalid
Severity: critical
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: hskwk at inter7.jp
--- Comment #0 from HOSOKAWA Kenchi <hskwk at inter7.jp> 2009-09-05 19:14:18 PDT ---
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?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list