[Issue 21685] New: bad error message on private constructor: member this is not accessible

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 7 15:10:20 UTC 2021


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 at puremagic.com
          Reporter: tobias at 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.

--


More information about the Digitalmars-d-bugs mailing list