Disallowing S() when struct S has a constructor

Ogi ogion.art at gmail.com
Fri Aug 30 16:58:25 UTC 2024


On Friday, 30 August 2024 at 15:17:06 UTC, Steven Schveighoffer 
wrote:
> I have a bold suggestion instead -- let's just start having 
> default constructors.
>
> What's stopping us? We are on the cusp of ridding ourselves of 
> magic runtime hooks, they are all now becoming templates.
>
> For instance, setting the length of an array now calls a 
> template and that template could just call the default 
> constructor if it exists.

I have a much less radical 
[proposal](https://forum.dlang.org/thread/ekskxgqdyyajbagnxfer@forum.dlang.org). A struct with a default constructor can only be initialized by a constructor call, just like a struct with a disabled default constructor.


More information about the Digitalmars-d mailing list