diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index fe25d894a7dacf091ec595932d74bde742ff11b9..c3206a577c813e299a46e49f995e49c1ee3f88f9 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -64,7 +64,11 @@ static char * dupStringWithLen(const char * s, size_t size)
 
 RootValue allocRootValue(Value * v)
 {
+#if HAVE_BOEHMGC
     return std::allocate_shared<Value *>(traceable_allocator<Value *>(), v);
+#else
+    return std::make_shared<Value *>(v);
+#endif
 }