www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18415] New: Typedef ignores disabled default constructor

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

          Issue ID: 18415
           Summary: Typedef ignores  disabled default constructor
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: simen.kjaras gmail.com

When a type that has a disabled default constructor is used in
std.typecons.Typedef, it's possible to create an uninitialized instance of the
type, since Typedef doesn't disable its constructor:


unittest {
    import std.typecons : Typedef;

    struct S {
         disable this();
    }

    //S s1; // Fails horribly.
    Typedef!S s1; // Compiles without issue.
}

--
Feb 10 2018