[Issue 2469] New: arbitrary struct accepted as struct initializer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 23 01:56:10 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2469

           Summary: arbitrary struct accepted as struct initializer
           Product: D
           Version: 1.035
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: kamm-removethis at incasoftware.de


The following code compiles

struct Foo { double d; }
struct Bar { byte b; }
void main() { Foo foo; Bar bar = foo; }

even though Foo is not implicitly convertible to Bar. In contrast, assigning

Foo foo;
Bar bar;
bar = foo;

fails as expected.


-- 



More information about the Digitalmars-d-bugs mailing list