www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3076] New: ICE[ztc\cod1.c:1673] - Compiler doesn't care about struct types in initializers

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3076

           Summary: ICE[ztc\cod1.c:1673] - Compiler doesn't care about
                    struct types in initializers
           Product: D
           Version: 1.042
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid, ice-on-invalid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: jarrett.billingsley gmail.com


The compiler doesn't seem to care if you initialize a struct variable with a
struct of an incorrect type.  Maybe it's supposed to be checking for a static
opCall but fails to diagnose an error when it fails to find one?

struct A {}
struct B {}
A a = B(); // accepted!
a = B(); // properly flagged as an error

This can lead to the ICE mentioned in the description, if the source type is
smaller than the destination, at least for some values of "smaller," *and* the
source is a function call.  The following, for instance, causes it:

struct Small { uint x; }
struct Large { uint x, y, z; }
Small foo() { return Small(); }
void main() { Large l = foo(); } // bang!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 17 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3076


Christian Kamm <kamm-removethis incasoftware.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |kamm-removethis incasoftwar
                   |                            |e.de
         Resolution|                            |DUPLICATE





2009-06-17 23:19:21 PDT ---


*** This issue has been marked as a duplicate of issue 2469 ***

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