Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callee destruction forces destructor attributes onto any function that receive by-value #20570

Open
TurkeyMan opened this issue Dec 17, 2024 · 0 comments

Comments

@TurkeyMan
Copy link
Contributor

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.

@TurkeyMan 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant