-
Notifications
You must be signed in to change notification settings - Fork 21
Switch to C++ 23 and remove backports #3727
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
Conversation
The behavior changed around the variadic template constructor. It matches copy-constructors and so the latter are no longer auto-generated.
This was a false-positive from a temporary ElementArrayView
| // such as sc.empty are fast and do not call constructors and initialize | ||
| // memory --- in particular since this is also used internally for | ||
| // initialization the output in the implementation of many operations. | ||
| ASSERT_TRUE(std::is_pod_v<time_point>); |
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.
is_pod has been deprecated: https://stackoverflow.com/questions/48225673/why-is-stdis-pod-deprecated-in-c20
| vector(const vector &other) = default; | ||
| vector(vector &&other) noexcept = default; | ||
| vector &operator=(const vector &other) = default; | ||
| vector &operator=(vector &&other) noexcept = default; |
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.
These are needed because the variadic constructor below matches copy-constructors but its implementation does not work in that case. It seems like the compiler no longer generates a copy-constructor in this case.
The const / non-const overloads for the copy-consdtructor are needed because given only
vector(const vector &other) = default;
template <class... Args>
vector(Args &&...args) : data(std::forward<Args>(args)...) {}and calling it with a non-const lvalue, the variadic constructor provides a bettar match than the const copy-constructor.
| for (scipp::index i = 0; i < indices.dims().volume(); ++i) { | ||
| const auto &[begin, end] = indices.values<index_pair>()[i]; | ||
| const auto values = indices.values<index_pair>(); | ||
| const auto &[begin, end] = values[i]; |
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.
This and other similar cases are about avoiding a false-positive lifetime warning from returning references from a temporary ElementArrayView (return value of .values()).
|
Could you also test wheel builds as a sanity check? Something like a14b8ec should trigger the builds. |
https://github.com/scipp/scipp/actions/runs/15757030298 The wheel builds seem to be fine. But there is a broken conda build: #3728 |
SimonHeybrock
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.
👍
| if(NOT DEFINED CMAKE_CXX_STANDARD) | ||
| set(CMAKE_CXX_STANDARD 17) | ||
| set(CMAKE_CXX_STANDARD 23) | ||
| endif(NOT DEFINED CMAKE_CXX_STANDARD) |
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.
Is it (currently at least) still possible to compile with 20 by settings this by hand? Or are we using any 23 features?
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.
It is possible by switching it in lib/CMakeLists.txt. Not sure if you can mix standards by changing it only in the package test. But nobody uses that anyway.
See #3725