www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16171] New: std.experimental.allocator.make does not respect

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

          Issue ID: 16171
           Summary: std.experimental.allocator.make does not respect
                    private class constructors
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: joeyemmons 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(); // Works
}

...

module other;
class test{
    private this(){
    }
}


Worse even is it will still work even if class test does not have a default
constructor at all.

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

--
Jun 14 2016