diff --git a/include/CppSharp.h b/include/CppSharp.h index 48c7d82fe1..1ecb41fd3e 100644 --- a/include/CppSharp.h +++ b/include/CppSharp.h @@ -207,11 +207,12 @@ namespace clix { typename detail::StringTypeSelector::Type, System::String ^ >::Type marshalString(SourceType string) { + constexpr detail::MarshalingDirection direction = + detail::IfManaged::Result ? detail::CxxFromNet : detail::NetFromCxx; + using StringMarshaler = detail::StringMarshaler; - // Pass on the call to our nifty template routines - return detail::StringMarshaler< - detail::IfManaged::Result ? detail::CxxFromNet : detail::NetFromCxx - >::marshal(string); + // Pass on the call to our nifty template routines + return StringMarshaler::template marshal(string); } diff --git a/tests/dotnet/CSharp/CSharpTemplates.h b/tests/dotnet/CSharp/CSharpTemplates.h index 42aa03ed05..fd5544177d 100644 --- a/tests/dotnet/CSharp/CSharpTemplates.h +++ b/tests/dotnet/CSharp/CSharpTemplates.h @@ -218,7 +218,8 @@ void Base::Nested::f(const T& t) template void Base::invokeFriend() { - f(Nested()); + Nested n; + f(n); } template diff --git a/tests/dotnet/NamespacesDerived/NamespacesDerived.h b/tests/dotnet/NamespacesDerived/NamespacesDerived.h index abed58c525..f51cf41740 100644 --- a/tests/dotnet/NamespacesDerived/NamespacesDerived.h +++ b/tests/dotnet/NamespacesDerived/NamespacesDerived.h @@ -101,7 +101,14 @@ template class CustomAllocator { public: - typedef T value_type; + using value_type = T; + using pointer_type = void*; + + CustomAllocator() = default; + + template + CustomAllocator(const CustomAllocator&) noexcept { + } T* allocate(size_t cnt, const void* = 0) { return 0; } void deallocate(T* p, size_t cnt) {}