diff --git a/src/lib/idi/entry-id.hpp b/src/lib/idi/entry-id.hpp index 39ee5d466..edca5c30f 100644 --- a/src/lib/idi/entry-id.hpp +++ b/src/lib/idi/entry-id.hpp @@ -133,7 +133,7 @@ namespace idi { * generates differing hash-IDs for different type parameters */ BareEntryID (string const& symbolID, HashVal seed =0) - : symbol_(util::sanitise(symbolID)) + : symbol_(symbolID) , hash_(buildHash (symbol_, seed)) { } @@ -169,7 +169,7 @@ namespace idi { template - EntryID recast() const; + EntryID const& recast() const; }; @@ -211,7 +211,7 @@ namespace idi { */ explicit EntryID (string const& symbolID) - : BareEntryID (symbolID, getTypeHash()) + : BareEntryID (util::sanitise(symbolID), getTypeHash()) { } @@ -226,14 +226,14 @@ namespace idi { return bID.getHash() == buildHash (bID.getSym(), getTypeHash()); } - static EntryID + static EntryID const& recast (BareEntryID const& bID) { if (!canRecast(bID)) throw error::Logic ("unable to recast EntryID: desired type " "doesn't match original definition" , error::LUMIERA_ERROR_WRONG_TYPE); - return EntryID (bID.getSym()); + return static_cast (bID); } @@ -268,7 +268,8 @@ namespace idi { * Exception if it doesn't match the stored hash. */ template - EntryID BareEntryID::recast() const + EntryID const& + BareEntryID::recast() const { return EntryID::recast(*this); }