Skip to content

Commit b9685f0

Browse files
authored
Fix compiler errors in debug/c++20 (#1892)
1 parent 56f1b7c commit b9685f0

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

include/CppSharp.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,12 @@ namespace clix {
207207
typename detail::StringTypeSelector<encoding>::Type,
208208
System::String ^
209209
>::Type marshalString(SourceType string) {
210+
constexpr detail::MarshalingDirection direction =
211+
detail::IfManaged<SourceType>::Result ? detail::CxxFromNet : detail::NetFromCxx;
212+
using StringMarshaler = detail::StringMarshaler<direction>;
210213

211-
// Pass on the call to our nifty template routines
212-
return detail::StringMarshaler<
213-
detail::IfManaged<SourceType>::Result ? detail::CxxFromNet : detail::NetFromCxx
214-
>::marshal<encoding, SourceType>(string);
214+
// Pass on the call to our nifty template routines
215+
return StringMarshaler::template marshal<encoding, SourceType>(string);
215216

216217
}
217218

tests/dotnet/CSharp/CSharpTemplates.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ void Base<T>::Nested::f(const T& t)
218218
template <typename T>
219219
void Base<T>::invokeFriend()
220220
{
221-
f(Nested());
221+
Nested n;
222+
f(n);
222223
}
223224

224225
template <typename T>

tests/dotnet/NamespacesDerived/NamespacesDerived.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,14 @@ template<typename T>
101101
class CustomAllocator
102102
{
103103
public:
104-
typedef T value_type;
104+
using value_type = T;
105+
using pointer_type = void*;
106+
107+
CustomAllocator() = default;
108+
109+
template <typename U>
110+
CustomAllocator(const CustomAllocator<U>&) noexcept {
111+
}
105112

106113
T* allocate(size_t cnt, const void* = 0) { return 0; }
107114
void deallocate(T* p, size_t cnt) {}

0 commit comments

Comments
 (0)