From: slipher Date: Sun, 5 Apr 2020 01:44:55 +0000 (+0200) Subject: clang/error: fix: non-type template argument refers to function ExportThunk that... X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=commitdiff_plain;h=f4a3b291bcf5cd0e8598b165f6a5aff463853d7a;hp=690f63b4ba610a17fb7bec1cb6d963ae5cf49ed5 clang/error: fix: non-type template argument refers to function ExportThunk that does not have linkage --- 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>(); }