https://issues.dlang.org/show_bug.cgi?id=13848
deadalnix <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID |--- --- Comment #2 from deadalnix <[email protected]> --- (In reply to Kenji Hara from comment #1) > (In reply to deadalnix from comment #0) > > auto fun() { > > return SS(a, p); > > } > > Your're trying to initialize SS.a by the value a. and SS.r by using p. What ? That do not make any sense. Also, I was able to trigger that error with an explicit constructor in a much more convoluted sample code. Basically as follow: module a; import b; struct S { mixin MixinTpl!P; this(...) { ... } } module b; template MixinTpl(P) { union { A a; } P p; auto fun() { return SS(a, p); } struct SS { union { A a; ulong r; } P p; } } struct A {} union P {} > Of course SS.a and SS.r are overlapped each other, so initializing the two > fields at the same time is invalid. > > In this case, you cannot use literal style syntax to construct SS. An > alternative way is: > > auto fun() { > SS ss = {a:a, p:p}; // use StructInitializer syntax > return ss; > } Ok at least I have a workaround, thank. There is still an issue in there, so I'm reopening. --
