-
Notifications
You must be signed in to change notification settings - Fork 1.6k
LWG-3211 std::tuple<> should be trivially constructible #1460
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
LWG-3211 std::tuple<> should be trivially constructible #1460
Conversation
|
Thanks for providing the patch. However, there are other things to do:
|
Thanks for useful notice. I'l fix everything and will be more attentive in future |
Doesn't it depend of implementation is |
No need to feel bad. This is tricky stuff with lots of hidden convention and unknown hooks attached. You are doing fine ;)
So the question is whether we can change properties of the class. Previously We would change the behavior of previousstandard modes, which often is tricky, but not unheard of. I would definitely defer to a maintainer here. This is also the reason you often see things like #if _HAS_CXX20
#else // ^^^ _HAS_CXX20 / vvv !_HAS_CXX20 vvv
#endif // !_HAS_CXX20 |
|
We follow different conventions for features and LWG issues. For features, we guard them with For LWG issues, we implement them unconditionally, unless we discover that they have significant source-breaking impact. That's very rare - LWG-2221 "No formatted output operator for Here, if changing As the comment for |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Looks like the only thing this PR needs is adding a line to a test somewhere, verifying that |
…11_tuple_trivial_default_ctor
miscco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for fixing this!
StephanTLavavej
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks good to me! I'll push an essentially stylistic change to the test.
|
I've verified that this preserves ABI. 😻 Full test case, compiled with x64: struct CurrentTuple {
constexpr CurrentTuple() noexcept {}
constexpr CurrentTuple(const CurrentTuple&) noexcept {}
};
struct ThisPR {
constexpr ThisPR() noexcept = default;
constexpr ThisPR(const ThisPR&) noexcept {}
};
struct BrokeABI {
constexpr BrokeABI() noexcept {}
constexpr BrokeABI(const BrokeABI&) noexcept = default;
};
template <typename Base>
struct TwoInts : Base {
int x;
int y;
};
int func1(TwoInts<CurrentTuple> a) {
return a.x + a.y;
}
int func2(TwoInts<ThisPR> a) {
return a.x + a.y;
}
int func3(TwoInts<BrokeABI> a) {
return a.x + a.y;
}
int main() {
TwoInts<CurrentTuple> current{};
TwoInts<ThisPR> thispr{};
TwoInts<BrokeABI> brokeabi{};
func1(current);
func2(thispr);
func3(brokeabi);
}Inspecting
|
|
Thanks for implementing this LWG issue and improving |
LWG-3211 std::tuple<> should be trivially constructible
Fixes #1459