www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21685] New: bad error message on private constructor: member

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

          Issue ID: 21685
           Summary: bad error message on private constructor: member this
                    is not accessible
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: tobias pankrath.net

--bad_error_main.d
import bad_error;

void main()
{
    new E;
}
--

--bad_error.d
module bad_error;

class E
{
    private this() {}
}
--

Gives: bad_error_main.d(5): Error: class bad_error.E member this is not
accessible

That confused me a lot. I first thought that there is somehow a problem with
the this-pointer, not with the constructor.

My proposal is to fit `constructor` somewhere in there: constructor `this` is
not accessible or similar.

--
Mar 07