From bbd7f62a426e321034c7bdf9054152fc159e517a Mon Sep 17 00:00:00 2001 From: "J. Tyne" Date: Thu, 13 Dec 2012 14:22:35 +0000 Subject: [PATCH] Change some implicit conversions to return const references to objects... ...instead of temporary objects. Fixes bug #20360. --- src/shared_object.hpp | 2 +- src/tstring.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared_object.hpp b/src/shared_object.hpp index 89be3b8..a6099a8 100644 --- a/src/shared_object.hpp +++ b/src/shared_object.hpp @@ -51,7 +51,7 @@ class shared_object { val_->count++; } - operator T() const { + operator const T &() const { assert(valid()); return val_->val; } diff --git a/src/tstring.hpp b/src/tstring.hpp index a391d58..f4664f5 100644 --- a/src/tstring.hpp +++ b/src/tstring.hpp @@ -145,7 +145,7 @@ class t_string : static t_string from_serialized(const std::string& string) { return t_string(base::from_serialized(string)); } std::string to_serialized() const { return get().to_serialized(); } - operator t_string_base() const { return get(); } + operator const t_string_base &() const { return get(); } t_string operator+(const t_string& o) const { return get() + o.get(); } t_string operator+(const std::string& o) const { return get() + o; } -- 1.8.1.6