-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Proposal: Use C++20 #7203
Proposal: Use C++20 #7203
Conversation
d70f8a5
to
4563e80
Compare
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.
We're already using some C++20 features in practice (designated initializers is the first that comes to my mind but I think there's a couple other things). So if something requires C++20, I don't see any objection towards fully making the switch.
Deferring to @edolstra or the rest of the maintainers though for a final call
The compilers we're currently using don't support all of C++20. So we can only use some features like designated initializers. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/tweag-nix-dev-update-38/22805/1 |
@edolstra which compilers are you refeering to? The darwin builds used to have a very old clang, but it is now using clang 11 Afaik (which technically doesn't support the whole of c++20, but close-enough). Is there anything else blocking us there? |
I was mostly thinking about gcc, but it looks like the support for C++20 in gcc/libstdc++ 11 is pretty good now: https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html |
Yes I think gcc 11's support for C++20 is pretty good. See also https://en.cppreference.com/w/cpp/compiler_support |
Thanks, I just needed this for |
Looks like CI doesn't run on Bors could help us prevent this. |
Weird, I did test a version of this rebased on master. |
Maybe it only happens on clang. |
It also fails on aarch64-linux, though with a different error:
Looks like we're using an older version of gcc (9.3.0) on aarch64-linux... 😖 According to NixOS/nixpkgs/00a0eeb2cb9f63b42dbc15d4a15b5d2a403852f5 this is because of "unresolved issues". |
That's rather non-optional. Maybe we're not quite ready for C++20 then. Might |
There's a tracking issue |
Or we use gcc11Stdenv on aarch64-linux. It would be rather sad to revert this because aarch64-linux is stuck indefinitely on an old version of gcc. That cannot be a maintainable situation for nixpkgs either. It kind of defeats the purpose of a standard environment if stdenv on some architectures has a different version of gcc... |
|
I wonder what bugs we'd be getting ourselves into, and isn't this risky to combine with non-gcc-11 packages?
I don't think that's the reason for the name, but I agree. |
I'm afraid that this upgrade will send us down a very counterproductive rabbit hole. Is there a reasonable alternative to |
Of course, but being stuck on an outdated version of gcc is not a viable long-term situation. |
This might be a more relevant tracking/goal issue: NixOS/nixpkgs#208412 TL;DR: We have a solution to upgrade GCC on My vote would be to revert this until a solution is merged into nixpkgs. I would worry about mixing the GCC version of such a fundamental package, and there is the possibility of rare and hard to detect bugs being induced with GCC 11 (which is why it hasn't been upgraded yet). |
The mixing sounds problematic just for packages that link against nix libs. They will probably be forced to use the same compiler version (because C++ ABI). |
Would there be an objection to using C++20 for the Nix codebase? We are working on a future patch (related to S3) that might benefit from C++ 20, so thought it was worth raising a PR to upgrade to see if it's feasible. I'm not sure what the constraints are for compatibility in various environments.