[Issue 14496] New: void initialization of member with indirections must not be @safe

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Apr 24 10:12:24 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14496

          Issue ID: 14496
           Summary: void initialization of member with indirections must
                    not be @safe
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: schuetzm at gmx.net

This should not compile:

struct Foo {
    int* indirection1;
    Object indirection2;
    string[] indirection3;
}

struct Bar {
    Foo foo = void; 
}

struct Baz {
    int* x = void;
}

@safe void main() {
    Bar bar;
    Baz baz;
}

Found by Justin Whear:
https://github.com/D-Programming-Language/phobos/pull/3213#issuecomment-95982584

--


More information about the Digitalmars-d-bugs mailing list