[Issue 16652] [Reg 2.071] returned rvalue destroyed too early

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 14 11:05:51 UTC 2018


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

--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> ---
(In reply to Walter Bright from comment #2)
> It's the inlining of bar() that elicits the bug.

Looking at the AST for main() without inlining:

  _D4test3barFPhZv call  (dctor  info  ((__slVecto3 = 0) , (Vector.ctor call 
(1  param  &__slVecto3))));
  ddtor (Vector.dtor call  &__slVecto);
  0L ;

and it looks correct. With inlining:


  v = (dctor info ((__slVecto3 =  0) , (Vector.ctor call  (1  param 
&__slVecto3))));
  ddtor (Vector.dtor call  &__slVecto3);
  (*v == 1) || (_d_assertp call  (19L  param  #__a6_746573742e64));
  0L ;

and the destructor call is clearly too soon.

--


More information about the Digitalmars-d-bugs mailing list