[Issue 23164] [REG 2.097] Infinite loop on assertion failure + DMD moves struct with copy constructor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 22 11:36:58 UTC 2022


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

--- Comment #7 from Iain Buclaw <ibuclaw at gdcproject.org> ---
(In reply to Walter Bright from comment #6)
> (In reply to Iain Buclaw from comment #5)
> >     // GDC and LDC forces 'auto ref' to be 'ref', even when the
> >     // front-end decides to drop the 'ref' from the signature.
> >     ref std_string opAssign()(const auto ref std_string rhs)
> 
> Do you mean it does this for all functions, or just for opAssign? That
> regardless of `ref` or `auto ref` or ``, it passes by `ref`?
Not functions, types.

Either you let the optimizer/backend copy around, make temporaries, or put
pieces of an object in registers if it so requires.  Or you tag it with a flag
that disallows all the above.

In such cases the only meaningful semantic you can apply to such types is to
force all objects to be fully addressable, so passing and returning in memory
only.

What kind of objects get this flag? Any type that has non-trivial copy or
destruction semantics - i.e: `~this()`, `this(this)`, and `this(ref const
this)`

--


More information about the Digitalmars-d-bugs mailing list