[Issue 16172] New: std.experimental.allocator.make mistakenly thinks default construction possible on classes with a private constructor

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jun 14 06:04:00 PDT 2016


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

          Issue ID: 16172
           Summary: std.experimental.allocator.make mistakenly thinks
                    default construction possible on classes with a
                    private constructor
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: joeyemmons at yahoo.com

Allocator make with no extra args works on classes even when default
construction is not available. 

import other;
import std.experimental.allocator;
import std.experimental.allocator.mallocator;
void main(){
    // auto t1 = new test(); // Error 
    auto t = Mallocator.instance.make!test(); // Mistakenly Works 
}

...

module other;
class test{
    private this(int i){
             // No default constructor... 
    }
}


Related Issues: Issue 16171

--


More information about the Digitalmars-d-bugs mailing list