Thread overview
[Issue 24090] struct private constructor call outside module should not be allowed
[Issue 24090] private constructor should not be allowed
Aug 19, 2023
Nick Treleaven
Aug 19, 2023
Nick Treleaven
Sep 20, 2023
RazvanN
Sep 20, 2023
RazvanN
August 19, 2023
https://issues.dlang.org/show_bug.cgi?id=24090

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org

--- Comment #1 from Nick Treleaven <nick@geany.org> ---
Confirmed, also if the `this(int _id)` ctor is commented out then main.d no longer compiles. The two parameter ctor is not needed to reproduce this AFAICT.

--
August 19, 2023
https://issues.dlang.org/show_bug.cgi?id=24090

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
            Summary|private constructor should  |struct private constructor
                   |not be allowed              |call outside module should
                   |                            |not be allowed
           Severity|enhancement                 |normal

--
September 20, 2023
https://issues.dlang.org/show_bug.cgi?id=24090

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305@gmail.com
         Resolution|---                         |WORKSFORME

--- Comment #2 from RazvanN <razvan.nitu1305@gmail.com> ---
I cannot reproduce this with git master.

I get:

main.d(12): Error: constructor `student.Student.this` of type `ref
Student(string _name)` is not accessible from module `main`


@Mike @Nick what compiler versions are you using?

Closing as WORKSFORME.

--
September 20, 2023
https://issues.dlang.org/show_bug.cgi?id=24090

--- Comment #3 from RazvanN <razvan.nitu1305@gmail.com> ---
It seems that this PR: https://github.com/dlang/dmd/pull/15282 has fixed it.

--