[Issue 24415] Can't call public constructor preceded by private template constructor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 26 20:05:49 UTC 2024


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

Paul Backus <snarwin+bugzilla at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Can't call public copy      |Can't call public
                   |constructor preceded by     |constructor preceded by
                   |private template            |private template
                   |constructor                 |constructor

--- Comment #3 from Paul Backus <snarwin+bugzilla at gmail.com> ---
In fact, the public constructor doesn't have to be a copy constructor to
trigger the bug. Any kind of constructor will do.

--- lib.d
module lib;

struct S
{
    int n;
    private this()(int n) { this.n = m; }
    this(string s) inout {}
}
--- app.d
module app;

import lib;

void main()
{
    S a = "hello"; // Error
}
---

--


More information about the Digitalmars-d-bugs mailing list