Skip to content

Conversation

@davezarzycki
Copy link
Contributor

Top-of-tree clang enables -Wdefaulted-function-deleted, therefore the following changes are needed for warning free builds.

@davezarzycki
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Contributor

@jrose-apple jrose-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like many of these are indicative of other bugs, and should not necessarily be silenced in this way. But maybe that just means tweaking the comments to include "FIXME" or something.

I don't think we should ever have a case where something has a move constructor but not a move assignment operator except if there's a very good reason. If it's just const members, we should un-constify them unless it's semantically important that all the const members are initialized together.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems like a bug, actually. CharSourceRange should be a trivial type. Or is this about the const?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' does seem to be the problem.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd probably just leave this out.

@davezarzycki davezarzycki force-pushed the fix_Wdefaulted-function-deleted-warnings branch from 8ce832e to bf7f91b Compare November 17, 2018 13:32
@davezarzycki
Copy link
Contributor Author

Hi @jrose-apple – I was worried about this devolving into something like "const correctness" whack-a-mole, but it turns out to be not that bad. Please consider the updated patch.

@davezarzycki
Copy link
Contributor Author

@swift-ci please smoke test

@compnerd
Copy link
Member

@davezarzycki thanks for fixing this, I had gotten half way through the same set of changes and then got worried how deep the rabbit hole was.

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had tried to use nullability attributes for the ProjectionTree to provide the same guarantees, but that got out of hand pretty quick.

@davezarzycki davezarzycki merged commit fef48a5 into swiftlang:master Nov 18, 2018
@davezarzycki davezarzycki deleted the fix_Wdefaulted-function-deleted-warnings branch November 18, 2018 16:40
CharSourceRange() {}
CharSourceRange() = default;

CharSourceRange &operator=(const CharSourceRange &) = default;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule of Zero says that we should not declare this explicitly. If you think it's important, we should follow the Rule of Five instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CharSourceRange() {} is effectively CharSourceRange() = default, right? If so, then yes, I can flush out the rule-of-five.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule of Five doesn't include the default constructor anyway, so just deleting this newest line is fine. The reason to keep it would be to see if we regress, I guess, but then we should definitely include all five = default special members.

TreeScopedHashTableVal(const TreeScopedHashTableVal &) = delete;
TreeScopedHashTableVal(TreeScopedHashTableVal &&) = delete;
TreeScopedHashTableVal &operator=(const TreeScopedHashTableVal &) = delete;
TreeScopedHashTableVal &operator=(TreeScopedHashTableVal &&) = delete;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule of Five says it's worth mentioning the destructor here too.

ExclusiveBorrowFormalAccess &
operator=(ExclusiveBorrowFormalAccess &&) = default;

ExclusiveBorrowFormalAccess() = default;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The superclass doesn't have a default constructor, so the subclass can't either.

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

Successfully merging this pull request may close these issues.

3 participants