From 8432420726ca26038ab62941916253c22d264691 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 9 Nov 2018 23:09:16 +0100 Subject: [PATCH] Library: fix unwanted implicit conversion ...it should have been explicit from start, since there is no point in converting an EntryID into a plain flat string without further notice this became evident, when the compiler picked the string overload on MakeRec().genNode(specialID) ...which is in compliance to the rules, since string is a direct match, while BareEntryID would be an (slicing) upcast. However, obviously we want the BareEntryID here, and not an implicit string conversion, thereby discarding the special hash value hidden within the ID --- src/lib/idi/entry-id.hpp | 2 +- tests/core/proc/asset/basicpipetest.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/idi/entry-id.hpp b/src/lib/idi/entry-id.hpp index 8a860a9c5..5da10074f 100644 --- a/src/lib/idi/entry-id.hpp +++ b/src/lib/idi/entry-id.hpp @@ -265,7 +265,7 @@ namespace idi { return static_cast (bID); } - + explicit operator string() const; friend bool operator< (EntryID const& i1, EntryID const& i2) { return i1.getSym() < i2.getSym(); } diff --git a/tests/core/proc/asset/basicpipetest.cpp b/tests/core/proc/asset/basicpipetest.cpp index 0947d2f6e..f0bf2126b 100644 --- a/tests/core/proc/asset/basicpipetest.cpp +++ b/tests/core/proc/asset/basicpipetest.cpp @@ -96,7 +96,7 @@ namespace test { Asset::Ident idi = thePipe->ident; CHECK (idi.org == "lumi"); CHECK (contains (idi.name, thePipe->getPipeID())); - CHECK (contains (idi.name, thePipe->getStreamID())); + CHECK (contains (idi.name, string{thePipe->getStreamID()})); Category cat{idi.category}; Category refcat{STRUCT,"pipes"}; @@ -146,7 +146,7 @@ namespace test { pipe2 = asset::Struct::retrieve (Query{"pipe(default)"}); CHECK (pipe2 == pipe1); - string sID = pipe1->getStreamID(); // sort of a "default stream type" + auto sID = string{pipe1->getStreamID()}; // sort of a "default stream type" PPipe pipe3 = Pipe::query ("stream("+sID+")"); CHECK (pipe3); CHECK (pipe3->getStreamID() == StreamType::ID{sID});