On Saturday, 22 August 2026 at 05:50:00 UTC, DanielG wrote:
here's another version of the code with reduced comments for easier reading on the website:

```
import std.stdio;

class MyClass {
        @disable this();

        this(string y = "hi") {
                writeln("hello from MyClass constructor");
        }
}

void main()
{
        // always works
        auto x = new MyClass("hi");

        // error, depending on @disable this()
        // why won't it match the ctor with default args?
        auto y = new MyClass();
}
```

I think you've reached a grey zone related to overload resolution. This is worth a bug report. The fix is not necessarily to allow that code but maybe to update the specs.

Anyway, good catch I'd say.

Reply via email to