Why allow initializers of non-static members that allocate?

Mike Parker aldacron at gmail.com
Sat Jun 11 10:52:58 UTC 2022


On Saturday, 11 June 2022 at 10:37:30 UTC, Bastiaan Veelo wrote:

>
> So that’s why I used “why” in the title of this thread, which I 
> haven’t seen an answer to yet. What is the practical case where 
> that warning would be annoying? When would you actually want 
> this behaviour?

After actually stopping to think about it (my earlier responses 
were reflexive), I agree with your initial assessment that it 
should be an error. It really only makes sense to allow the 
dynamic allocation if the fields are immutable and, in the case 
of arrays, the initializer is a literal.


More information about the Digitalmars-d-learn mailing list