Bug 3076 – ICE[ztc\cod1.c:1673] - Compiler doesn't care about struct types in initializers

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
Other
OS
Windows
Creation time
2009-06-17T20:15:00Z
Last change time
2014-04-18T09:12:07Z
Keywords
accepts-invalid, ice-on-invalid-code
Assigned to
nobody
Creator
jarrett.billingsley

Comments

Comment #0 by jarrett.billingsley — 2009-06-17T20:15:38Z
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!
Comment #1 by kamm-removethis — 2009-06-17T23:19:21Z
*** This issue has been marked as a duplicate of issue 2469 ***