[Issue 15604] std.array.array of structs with template opAssign and default initialised "new"ed class member.
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Jan 30 01:46:00 PST 2016
https://issues.dlang.org/show_bug.cgi?id=15604
--- Comment #3 from John Colvin <john.loughran.colvin at gmail.com> ---
(In reply to David Nadlinger from comment #2)
> As I pointed out in the GitHub issue, I'm not convinced that this is a
> regression. Isn't it just an accepts-invalid bug in the compiler that the
> struct declaration is considered valid in the first place?
>
> From looking at the codegen, I find it hard to imagine that the current
> behavior (a single implicitly-shared object instance) would be what the user
> would expect.
I agree and have since deleted all such things from the codebase I was working
on. I also hit some weird linker errors with them that I was unable to minimise
examples for, so good riddance.
On the topic of static initialisers with mutable indirections, what about
these:
struct A
{
int[] arr = [1, 2, 3];
}
or this:
Object globalSingleton;
struct B
{
Object o = globalSingleton;
}
--
More information about the Digitalmars-d-bugs
mailing list