Browse Source

Fix compiler errors in debug/c++20 (#1892)

pull/1879/merge
Jelle 5 months ago committed by GitHub
parent
commit
b9685f0477
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      include/CppSharp.h
  2. 3
      tests/dotnet/CSharp/CSharpTemplates.h
  3. 9
      tests/dotnet/NamespacesDerived/NamespacesDerived.h

9
include/CppSharp.h

@ -207,11 +207,12 @@ namespace clix {
typename detail::StringTypeSelector<encoding>::Type, typename detail::StringTypeSelector<encoding>::Type,
System::String ^ System::String ^
>::Type marshalString(SourceType string) { >::Type marshalString(SourceType string) {
constexpr detail::MarshalingDirection direction =
detail::IfManaged<SourceType>::Result ? detail::CxxFromNet : detail::NetFromCxx;
using StringMarshaler = detail::StringMarshaler<direction>;
// Pass on the call to our nifty template routines // Pass on the call to our nifty template routines
return detail::StringMarshaler< return StringMarshaler::template marshal<encoding, SourceType>(string);
detail::IfManaged<SourceType>::Result ? detail::CxxFromNet : detail::NetFromCxx
>::marshal<encoding, SourceType>(string);
} }

3
tests/dotnet/CSharp/CSharpTemplates.h

@ -218,7 +218,8 @@ void Base<T>::Nested::f(const T& t)
template <typename T> template <typename T>
void Base<T>::invokeFriend() void Base<T>::invokeFriend()
{ {
f(Nested()); Nested n;
f(n);
} }
template <typename T> template <typename T>

9
tests/dotnet/NamespacesDerived/NamespacesDerived.h

@ -101,7 +101,14 @@ template<typename T>
class CustomAllocator class CustomAllocator
{ {
public: public:
typedef T value_type; using value_type = T;
using pointer_type = void*;
CustomAllocator() = default;
template <typename U>
CustomAllocator(const CustomAllocator<U>&) noexcept {
}
T* allocate(size_t cnt, const void* = 0) { return 0; } T* allocate(size_t cnt, const void* = 0) { return 0; }
void deallocate(T* p, size_t cnt) {} void deallocate(T* p, size_t cnt) {}

Loading…
Cancel
Save