www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3302] New: Sloppy type check in dynamic initialization of struct

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: hskwk inter7.jp


--- Comment #0 from HOSOKAWA Kenchi <hskwk 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: -------
Sep 05 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3302


HOSOKAWA Kenchi <hskwk inter7.jp> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #1 from HOSOKAWA Kenchi <hskwk inter7.jp> 2009-09-05 19:20:39 PDT
---
*** This issue has been marked as a duplicate of issue 3259 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 05 2009