When D feels unfinished: union initialization and NRVO

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Mar 19 20:59:12 UTC 2020


On Thu, Mar 19, 2020 at 08:09:44PM +0000, Kagamin via Digitalmars-d wrote:
> On Thursday, 19 March 2020 at 18:46:13 UTC, H. S. Teoh wrote:
> > Lifetime analysis is either going to break down or become seriously
> > convoluted, if you try to apply it here!
> 
> case Good.Baguette:
>   if(true){
>     Foo f = { type_: type, f1: typeof(Foo.f1)("Hello World") };
>     return f;
>   }
> 
> Pretty sure if statement must be a self-contained scope, but even it
> doesn't reset scope here.

That sounds like a bug, similar to the bug with identically-named
local identifiers in disjoint subscopes in a function body.


T

-- 
"How are you doing?" "Doing what?"


More information about the Digitalmars-d mailing list