From 4ea8c9d6436f421dfd63638efd1fd01296bccc3f Mon Sep 17 00:00:00 2001 From: Lulu Date: Tue, 8 Oct 2024 20:05:28 +0200 Subject: [PATCH] Set c++ version to c++23 I followed @pennae's advice and moved the constructor definition of `AttrName` from the header file `nixexpr.hh` to `nixexpr.cc`. Change-Id: I733f56c25635b366b11ba332ccec38dd7444e793 --- meson.build | 2 +- src/libexpr/nixexpr.cc | 8 ++++++++ src/libexpr/nixexpr.hh | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index c7fe647ce..2cf86e985 100644 --- a/meson.build +++ b/meson.build @@ -50,7 +50,7 @@ project('lix', 'cpp', 'rust', meson_version : '>=1.4.0', version : run_command('bash', '-c', 'echo -n $(jq -r .version < ./version.json)$VERSION_SUFFIX', check : true).stdout().strip(), default_options : [ - 'cpp_std=c++2a', + 'cpp_std=c++23', 'rust_std=2021', 'warning_level=2', 'debug=true', diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 68da254e2..4b659b71a 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -21,6 +21,14 @@ std::ostream & operator <<(std::ostream & str, const SymbolStr & symbol) return printIdentifier(str, s); } +AttrName::AttrName(Symbol s) : symbol(s) +{ +} + +AttrName::AttrName(std::unique_ptr e) : expr(std::move(e)) +{ +} + void Expr::show(const SymbolTable & symbols, std::ostream & str) const { abort(); diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index d16281c39..4e857b321 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -30,8 +30,8 @@ struct AttrName { Symbol symbol; std::unique_ptr expr; - AttrName(Symbol s) : symbol(s) {}; - AttrName(std::unique_ptr e) : expr(std::move(e)) {}; + AttrName(Symbol s); + AttrName(std::unique_ptr e); }; typedef std::vector AttrPath;