diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index ef9f8efca96c2593f32e1a3976883cc47f73e0f3..ceca6e16bc364cc0b7d143ff9b335c4d9830e237 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
 }