[Issue 21645] template value argument capriciously rejects class objects literals

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 18 03:58:48 UTC 2021


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

--- Comment #1 from Adam D. Ruppe <destructionator at gmail.com> ---
I suspect the reason has to do with mangling the class values, but it isn't
that different than a struct, so I don't think it is fundamentally problematic.

Another related problem is that `enum Object o = new Object;` is not allowed,
since then you'd have questions of Object aliasing at runtime (arrays are
arguably similar but they solve it by reallocating for each use, so perhaps a
class could do that too, but I also don't think this is required at all since a
template can just use it at CTFE then export it as `static` instead of `enum`).

--


More information about the Digitalmars-d-bugs mailing list