From 05203414114d09d3c462a2ae450bd3cd1c97312b Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 28 Oct 2017 18:29:15 +0200 Subject: [PATCH] Fix passing temporary to Reflector::push() --- lib/tests/jsonreflector.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tests/jsonreflector.cpp b/lib/tests/jsonreflector.cpp index 2671de6..47170fe 100644 --- a/lib/tests/jsonreflector.cpp +++ b/lib/tests/jsonreflector.cpp @@ -182,7 +182,8 @@ void JsonReflectorTests::testSerializePrimitives() Document::Array array(doc.GetArray()); // string - Reflector::push("foo"s, array, alloc); + const string foo("foo"); // musn't be destroyed until JSON is actually written + Reflector::push(foo, array, alloc); Reflector::push("bar", array, alloc); // number Reflector::push(25, array, alloc);