Browse Source

Fixed the generated C# when a template returns a specialisation with itself as a type arg.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1026/head
Dimitar Dobrev 8 years ago
parent
commit
10607164ed
  1. 2
      src/Generator/AST/Utils.cs
  2. 7
      tests/CSharp/CSharpTemplates.h

2
src/Generator/AST/Utils.cs

@ -108,7 +108,7 @@ namespace CppSharp.AST
if (specialization.Arguments.Select( if (specialization.Arguments.Select(
a => a.Type.Type).Any(t => t != null && a => a.Type.Type).Any(t => t != null &&
!CheckTypeForSpecialization(t, container, addSpecialization, !CheckTypeForSpecialization(t, specialization, addSpecialization,
typeMaps, internalOnly))) typeMaps, internalOnly)))
return false; return false;

7
tests/CSharp/CSharpTemplates.h

@ -514,8 +514,15 @@ TemplateDerivedFromRegularDynamic<T>::~TemplateDerivedFromRegularDynamic()
template <typename T> template <typename T>
class OnlySpecialisedInTypeArg class OnlySpecialisedInTypeArg
{ {
public:
DependentValueFields<OnlySpecialisedInTypeArg<T>> returnSelfSpecialization();
}; };
template <typename T>
DependentValueFields<OnlySpecialisedInTypeArg<T>> OnlySpecialisedInTypeArg<T>::returnSelfSpecialization()
{
}
// we optimise specialisations so that only actually used ones are wrapped // we optimise specialisations so that only actually used ones are wrapped
void forceUseSpecializations(IndependentFields<int> _1, IndependentFields<bool> _2, void forceUseSpecializations(IndependentFields<int> _1, IndependentFields<bool> _2,
IndependentFields<T1> _3, IndependentFields<std::string> _4, IndependentFields<T1> _3, IndependentFields<std::string> _4,

Loading…
Cancel
Save