Skip to content

Commit

Permalink
Fix compiler errors in debug/c++20 (#1892)
Browse files Browse the repository at this point in the history
  • Loading branch information
duckdoom5 authored Jan 22, 2025
1 parent 56f1b7c commit b9685f0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
9 changes: 5 additions & 4 deletions include/CppSharp.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,12 @@ namespace clix {
typename detail::StringTypeSelector<encoding>::Type,
System::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
return detail::StringMarshaler<
detail::IfManaged<SourceType>::Result ? detail::CxxFromNet : detail::NetFromCxx
>::marshal<encoding, SourceType>(string);
// Pass on the call to our nifty template routines
return StringMarshaler::template marshal<encoding, SourceType>(string);

}

Expand Down
3 changes: 2 additions & 1 deletion tests/dotnet/CSharp/CSharpTemplates.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ void Base<T>::Nested::f(const T& t)
template <typename T>
void Base<T>::invokeFriend()
{
f(Nested());
Nested n;
f(n);
}

template <typename T>
Expand Down
9 changes: 8 additions & 1 deletion tests/dotnet/NamespacesDerived/NamespacesDerived.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,14 @@ template<typename T>
class CustomAllocator
{
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; }
void deallocate(T* p, size_t cnt) {}
Expand Down

0 comments on commit b9685f0

Please sign in to comment.