Private struct constructor
Simen Kjærås
simen.kjaras at gmail.com
Thu Oct 4 09:21:39 UTC 2018
On Thursday, 4 October 2018 at 08:52:50 UTC, Ritchie wrote:
> I apologize for not making it clear. I was talking about the
> private constructor only. The @disable this() is there to
> prevent struct literal syntax and the other disables really
> have no reason to be there for the purpose of this question.
>
> Oddly enough I asked this because I was working on something
> and was able to call the private constructor from another
> module, but then I created the run.dlang.io snippet to demo my
> problem.
Right. Reduced your example to this:
module bar;
struct S() {
private this()(int n) {}
}
module foo;
unittest {
import bar;
auto a = S!()(3);
}
This is apparently a known issue:
https://issues.dlang.org/show_bug.cgi?id=18979
which is basically just a special case of this issue:
https://issues.dlang.org/show_bug.cgi?id=2775
--
Simen
More information about the Digitalmars-d-learn
mailing list