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 18415 - Typedef ignores @disabled default constructor #6514

Merged
merged 1 commit into from May 19, 2018
Merged

fix issue 18415 - Typedef ignores @disabled default constructor #6514

merged 1 commit into from May 19, 2018

Conversation

ghost
Copy link

@ghost ghost commented May 18, 2018

The problem is only fixable for struct and union and not class, since Typedef is a struct.

@ghost ghost requested review from MetaLang and PetarKirov as code owners May 18, 2018 18:16
@dlang-bot
Copy link
Contributor

dlang-bot commented May 18, 2018

Thanks for your pull request and interest in making D better, @bbasile! 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 annotated coverage diff directly on GitHub with CodeCov's browser extension
  • 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
18415 normal Typedef ignores @disabled default constructor

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 + phobos#6514"

@MetaLang
Copy link
Member

I don't quite understand; why can't Typedef "forward" the @disable'd default constructor if T is a class?

@ghost
Copy link
Author

ghost commented May 19, 2018

For a class that has its default this disabled you can still declare a variable without initializer.
For a struct this is not the case.
Since the Typedef of a class is a struct this would end up with this scenario:

class A{@disable this();}
alias TA  = Typedef!A;

A a; // ok;
TA ta; // compile error, because Typedef wraps A in a struct with default construction disabled.

@MetaLang
Copy link
Member

Ah, makes perfect sense. Thanks @bbasile.

@dlang-bot dlang-bot merged commit b62baca into dlang:master May 19, 2018
@ghost ghost deleted the issue-18415 branch May 20, 2018 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants