Set the c++ version to 23 #541

Closed
opened 2024-10-07 23:52:20 +00:00 by lulu-berlin · 5 comments

I tried setting the c++ version to 23 by changing 'cpp_std=c++2a' to 'cpp_std=c++23' in meson.build and I get the following compile error:

[41/510] Compiling C++ object tests/functional/plugins/libplugintest.so.p/plugintest.cc.o
FAILED: tests/functional/plugins/libplugintest.so.p/plugintest.cc.o
clang++ -Itests/functional/plugins/libplugintest.so.p -Itests/functional/plugins -I../tests/functional/plugins -Isrc/libutil -I../src/libutil -Isrc/libstore -I../src/libstore -Isrc/libexpr -I../src/libexpr -Isrc/libfetchers -I../src/libfetchers -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++23 -O2 -g -fpch-instantiate-templates -include config.h -Wno-deprecated-declarations -Wimplicit-fallthrough -Werror=switch -Werror=switch-enum -Werror=unused-result -Wdeprecated-copy -Wignored-qualifiers -Werror=suggest-override -fsanitize=signed-integer-overflow -fsanitize-undefined-trap-on-error -ffile-prefix-map=../src=src -fPIC -MD -MQ tests/functional/plugins/libplugintest.so.p/plugintest.cc.o -MF tests/functional/plugins/libplugintest.so.p/plugintest.cc.o.d -o tests/functional/plugins/libplugintest.so.p/plugintest.cc.o -c ../tests/functional/plugins/plugintest.cc
In file included from ../tests/functional/plugins/plugintest.cc:1:
In file included from ../src/libutil/config.hh:8:
In file included from /nix/store/h7hy18zg0fq7726xaqyryni5yaf9cgn2-nlohmann_json-3.11.3/include/nlohmann/json_fwd.hpp:14:
In file included from /nix/store/llmjvk4i2yncv8xqdvs4382wr3kgdmvp-gcc-13.2.0/include/c++/13.2.0/memory:78:
/nix/store/llmjvk4i2yncv8xqdvs4382wr3kgdmvp-gcc-13.2.0/include/c++/13.2.0/bits/unique_ptr.h:97:16: error: invalid application of 'sizeof' to an incomplete type 'nix::Expr'
   97 |         static_assert(sizeof(_Tp)>0,
      |                       ^~~~~~~~~~~
/nix/store/llmjvk4i2yncv8xqdvs4382wr3kgdmvp-gcc-13.2.0/include/c++/13.2.0/bits/unique_ptr.h:404:4: note: in instantiation of member function 'std::default_delete<nix::Expr>::operator()' requested here
  404 |           get_deleter()(std::move(__ptr));
      |           ^
../src/libexpr/nixexpr.hh:33:5: note: in instantiation of member function 'std::unique_ptr<nix::Expr>::~unique_ptr' requested here
   33 |     AttrName(Symbol s) : symbol(s) {};
      |     ^
../src/libexpr/value.hh:66:8: note: forward declaration of 'nix::Expr'
   66 | struct Expr;
      |        ^
1 error generated.

Is this a Meson issue? The documentation doesn't specify c++23 as a possible value of cpp_std.

Maybe this issue in the Meson github repo is relevant.

I tried setting the c++ version to 23 by changing `'cpp_std=c++2a'` to `'cpp_std=c++23'` in `meson.build` and I get the following compile error: ``` [41/510] Compiling C++ object tests/functional/plugins/libplugintest.so.p/plugintest.cc.o FAILED: tests/functional/plugins/libplugintest.so.p/plugintest.cc.o clang++ -Itests/functional/plugins/libplugintest.so.p -Itests/functional/plugins -I../tests/functional/plugins -Isrc/libutil -I../src/libutil -Isrc/libstore -I../src/libstore -Isrc/libexpr -I../src/libexpr -Isrc/libfetchers -I../src/libfetchers -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++23 -O2 -g -fpch-instantiate-templates -include config.h -Wno-deprecated-declarations -Wimplicit-fallthrough -Werror=switch -Werror=switch-enum -Werror=unused-result -Wdeprecated-copy -Wignored-qualifiers -Werror=suggest-override -fsanitize=signed-integer-overflow -fsanitize-undefined-trap-on-error -ffile-prefix-map=../src=src -fPIC -MD -MQ tests/functional/plugins/libplugintest.so.p/plugintest.cc.o -MF tests/functional/plugins/libplugintest.so.p/plugintest.cc.o.d -o tests/functional/plugins/libplugintest.so.p/plugintest.cc.o -c ../tests/functional/plugins/plugintest.cc In file included from ../tests/functional/plugins/plugintest.cc:1: In file included from ../src/libutil/config.hh:8: In file included from /nix/store/h7hy18zg0fq7726xaqyryni5yaf9cgn2-nlohmann_json-3.11.3/include/nlohmann/json_fwd.hpp:14: In file included from /nix/store/llmjvk4i2yncv8xqdvs4382wr3kgdmvp-gcc-13.2.0/include/c++/13.2.0/memory:78: /nix/store/llmjvk4i2yncv8xqdvs4382wr3kgdmvp-gcc-13.2.0/include/c++/13.2.0/bits/unique_ptr.h:97:16: error: invalid application of 'sizeof' to an incomplete type 'nix::Expr' 97 | static_assert(sizeof(_Tp)>0, | ^~~~~~~~~~~ /nix/store/llmjvk4i2yncv8xqdvs4382wr3kgdmvp-gcc-13.2.0/include/c++/13.2.0/bits/unique_ptr.h:404:4: note: in instantiation of member function 'std::default_delete<nix::Expr>::operator()' requested here 404 | get_deleter()(std::move(__ptr)); | ^ ../src/libexpr/nixexpr.hh:33:5: note: in instantiation of member function 'std::unique_ptr<nix::Expr>::~unique_ptr' requested here 33 | AttrName(Symbol s) : symbol(s) {}; | ^ ../src/libexpr/value.hh:66:8: note: forward declaration of 'nix::Expr' 66 | struct Expr; | ^ 1 error generated. ``` Is this a Meson issue? [The documentation](https://mesonbuild.com/Builtin-options.html#compiler-options) doesn't specify `c++23` as a possible value of `cpp_std`. Maybe [this issue](https://github.com/mesonbuild/meson/issues/13733) in the Meson github repo is relevant.
Author

For context, this was suggested by @jade as a way to allow using numeric literals with the suffix uz without getting a warning in a comment to this change: https://gerrit.lix.systems/c/lix/+/2045.

For context, this was suggested by @jade as a way to allow using numeric literals with the suffix `uz` without getting a warning in a comment to this change: https://gerrit.lix.systems/c/lix/+/2045.
Owner

it's not a meson issue. libexpr is very slightly broken under c++23 for cursed c++ reasons that can be fixed by giving AttrName an explicit destructor declaration and defining that destructor in a cpp file rather than using the implicit definition

it's not a meson issue. libexpr is very slightly broken under c++23 for cursed c++ reasons that can be fixed by giving `AttrName` an explicit destructor declaration and defining that destructor in a cpp file rather than using the implicit definition
jade added the
devx
label 2024-10-08 01:39:56 +00:00
Member

This issue was mentioned on Gerrit on the following CLs:

  • comment in cl/2050 ("Set c++ version to c++23")
<!-- GERRIT_LINKBOT: {"cls": [{"backlink": "https://gerrit.lix.systems/c/lix/+/2050", "number": 2050, "kind": "comment"}], "cl_meta": {"2050": {"change_title": "Set c++ version to c++23"}}} --> This issue was mentioned on Gerrit on the following CLs: * comment in [cl/2050](https://gerrit.lix.systems/c/lix/+/2050) ("Set c++ version to c++23")
Author

The change was merged.

The change was merged.
Owner

fyi if you want to auto close issues after stuff gets merged, you can put "fixes #issuenum" or fixes https://git.lix.systems/lix-project/lix/issues/541 into the commit message.

fyi if you want to auto close issues after stuff gets merged, you can put "fixes #issuenum" or `fixes https://git.lix.systems/lix-project/lix/issues/541` into the commit message.
Sign in to join this conversation.
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#541
No description provided.