From e9be91e5aa64a22495fc870b47eece96daa32a00 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 7 Jul 2021 12:52:31 -0700 Subject: [PATCH] resolve ambiguity between Value::as(T&) and Value::as(FN&&) GCC circa 4.8 doesn't recognize that bool& is not callable, and fails when T=bool. Until std::is_invokable{} becomes usable (c++17), try to restrict FN to types which aren't included in StorageMap. --- src/pvxs/data.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pvxs/data.h b/src/pvxs/data.h index 16e41c9..2a73fa4 100644 --- a/src/pvxs/data.h +++ b/src/pvxs/data.h @@ -52,7 +52,9 @@ struct FieldDesc; //! store_t shall be convertible to/from T through StoreTransform::in() and out(). //! StorageMap::code is the associated StoreType. template -struct StorageMap; +struct StorageMap { + typedef void not_storable; +}; // map signed integers to int64_t template @@ -629,7 +631,7 @@ public: //! If possible, this value is cast to T and passed as the only argument //! of the provided function. template - void as(FN&& fn) const { + typename impl::StorageMap::type>::not_storable as(FN&& fn) const { typename impl::StoreAs::store_t val; if(tryCopyOut(&val, impl::StoreAs::code)) { fn(impl::StoreTransform::out(val));