diff --git a/src/libutil/canon-path.cc b/src/libutil/canon-path.cc index 07a3a6193..3b4777ef7 100644 --- a/src/libutil/canon-path.cc +++ b/src/libutil/canon-path.cc @@ -5,7 +5,7 @@ namespace nix { -CanonPath CanonPath::root = CanonPath("/"); +const CanonPath CanonPath::root = CanonPath("/"); static std::string absPathPure(std::string_view path) { diff --git a/src/libutil/include/nix/util/canon-path.hh b/src/libutil/include/nix/util/canon-path.hh index dd07929b4..a9c173d71 100644 --- a/src/libutil/include/nix/util/canon-path.hh +++ b/src/libutil/include/nix/util/canon-path.hh @@ -69,7 +69,7 @@ public: */ CanonPath(const std::vector & elems); - static CanonPath root; + static const CanonPath root; /** * If `raw` starts with a slash, return