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

Fix Issue 20367 - Postblit cannot be disabled when copy ctor is defined #10557

Merged
merged 1 commit into from Nov 11, 2019

Conversation

RazvanN7
Copy link
Contributor

If a struct defines both a postblit and a copy constructor and the postblit is disabled, go with the copy constructor.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @RazvanN7! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
20367 normal Postblit cannot be disabled when copy ctor is defined

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + dmd#10557"

@thewilsonator
Copy link
Contributor

Auto-merge toggled on

@thewilsonator thewilsonator merged commit a140329 into dlang:master Nov 11, 2019
@SSoulaimane
Copy link
Member

I remembered this function.

dmd/src/dmd/mtype.d

Lines 6748 to 6765 in a140329

/***************************************************
* Determine if type t is copyable.
* Params:
* t = type to check
* Returns:
* true if we can copy it
*/
bool isCopyable(const Type t) pure nothrow @nogc
{
//printf("isCopyable() %s\n", t.toChars());
if (auto ts = t.isTypeStruct())
{
if (ts.sym.postblit &&
ts.sym.postblit.storage_class & STC.disable)
return false;
}
return true;
}

You may want to look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants