[Issue 2851] New: Segfault using C-style struct initializer with too few arguments

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 17 23:48:09 PDT 2009


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

           Summary: Segfault using C-style struct initializer with too few
                    arguments
           Product: D
           Version: 2.027
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid, ice-on-invalid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: clugdbug at yahoo.com.au


The bug is that it doesn't check that the number of members in the initializer
is correct. It's silently accepted as long as you don't access an uninitialised
member; if you do, the compiler segfaults.

----
struct Test{
 int foo;
}

enum Test test = {};
enum q = test.foo;


-- 



More information about the Digitalmars-d-bugs mailing list