You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With recent move-semantics; by-value passing will have increased emphasis.
Callee destruction is largely incompatible with move semantics though; any function that receives an S by value must destruct S at end of scope, which means any attributes on the destructor are always asserted into any function that receives any S by value.
This is un-workable. Move semantics are often used to pass objects with elaborate construction/destruction through restrictive scopes; because moved objects don't allocate/free any memory when transferring ownership, a move is usually pure, @nogc, nothrow, where construction/destruction may often not tolerate any of those restrictions.
We need to consider caller-destruction. Right now, the best workaround for this problem is to attribute the function extern(C++) just to gain access to the preferred calling convention.
The text was updated successfully, but these errors were encountered:
TurkeyMan
changed the title
Callee destruction forces destructor attributes onto any methods that receive by-value
Callee destruction forces destructor attributes onto any function that receive by-value
Dec 18, 2024
With recent move-semantics; by-value passing will have increased emphasis.
Callee destruction is largely incompatible with move semantics though; any function that receives an
S
by value must destructS
at end of scope, which means any attributes on the destructor are always asserted into any function that receives anyS
by value.This is un-workable. Move semantics are often used to pass objects with elaborate construction/destruction through restrictive scopes; because moved objects don't allocate/free any memory when transferring ownership, a move is usually
pure
,@nogc
,nothrow
, where construction/destruction may often not tolerate any of those restrictions.We need to consider caller-destruction. Right now, the best workaround for this problem is to attribute the function
extern(C++)
just to gain access to the preferred calling convention.The text was updated successfully, but these errors were encountered: