From f4a3b291bcf5cd0e8598b165f6a5aff463853d7a Mon Sep 17 00:00:00 2001 From: slipher Date: Sun, 5 Apr 2020 03:44:55 +0200 Subject: [PATCH] clang/error: fix: non-type template argument refers to function ExportThunk that does not have linkage --- libs/property.h | 67 +++++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/libs/property.h b/libs/property.h index abdb32f4..f195ae24 100644 --- a/libs/property.h +++ b/libs/property.h @@ -102,6 +102,23 @@ Property make_property(Self &self) { // chain +template +struct make_property_chain_I_1 { + static void ExportThunk(const Callback &self, SRC value) { + PropertyImpl::Export(value, self); + } + + static void Export(const X &self, const Callback &returnz) { + A::Get::thunk_(self, ConstReferenceCaller, void(SRC), ExportThunk>(returnz)); + } + + static void Import(X &self, DST value) { + SRC out; + PropertyImpl::Import(out, value); + A::Set::thunk_(self, out); + } +}; + template Property> make_property_chain(detail::propertyimpl_self &it) { using DST = detail::propertyimpl_other; @@ -109,45 +126,35 @@ Property> make_property_chain(detail::proper using X = detail::propertyimpl_self; using A = property_impl; - struct I { - static void ExportThunk(const Callback &self, SRC value) { - PropertyImpl::Export(value, self); - } - - static void Export(const X &self, const Callback &returnz) { - A::Get::thunk_(self, ConstReferenceCaller, void(SRC), ExportThunk>(returnz)); - } - - static void Import(X &self, DST value) { - SRC out; - PropertyImpl::Import(out, value); - A::Set::thunk_(self, out); - } - }; + using I = make_property_chain_I_1; return make_property>(it); } +template +struct make_property_chain_I_2 { + static void ExportThunk(const Callback &self, SRC value) { + PropertyImpl::Export(value, self); + } + + static void Export(const Callback &returnz) { + A::Get::thunk_(nullptr, ConstReferenceCaller, void(SRC), ExportThunk>(returnz)); + } + + static void Import(DST value) { + SRC out; + PropertyImpl::Import(out, value); + A::Set::thunk_(nullptr, out); + } +}; + template Property> make_property_chain() { using DST = detail::propertyimpl_other; using SRC = detail::propertyimpl_self; using A = property_impl_free; - struct I { - static void ExportThunk(const Callback &self, SRC value) { - PropertyImpl::Export(value, self); - } - - static void Export(const Callback &returnz) { - A::Get::thunk_(nullptr, ConstReferenceCaller, void(SRC), ExportThunk>(returnz)); - } - - static void Import(DST value) { - SRC out; - PropertyImpl::Import(out, value); - A::Set::thunk_(nullptr, out); - } - }; + using I = make_property_chain_I_2; + return make_property>(); } -- 2.39.2