Skip to content

Commit 1060716

Browse files
committed
Fixed the generated C# when a template returns a specialisation with itself as a type arg.
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent fceb204 commit 1060716

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Generator/AST/Utils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static bool CheckTypeForSpecialization(Type type, Declaration container,
108108

109109
if (specialization.Arguments.Select(
110110
a => a.Type.Type).Any(t => t != null &&
111-
!CheckTypeForSpecialization(t, container, addSpecialization,
111+
!CheckTypeForSpecialization(t, specialization, addSpecialization,
112112
typeMaps, internalOnly)))
113113
return false;
114114

tests/CSharp/CSharpTemplates.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,15 @@ TemplateDerivedFromRegularDynamic<T>::~TemplateDerivedFromRegularDynamic()
514514
template <typename T>
515515
class OnlySpecialisedInTypeArg
516516
{
517+
public:
518+
DependentValueFields<OnlySpecialisedInTypeArg<T>> returnSelfSpecialization();
517519
};
518520

521+
template <typename T>
522+
DependentValueFields<OnlySpecialisedInTypeArg<T>> OnlySpecialisedInTypeArg<T>::returnSelfSpecialization()
523+
{
524+
}
525+
519526
// we optimise specialisations so that only actually used ones are wrapped
520527
void forceUseSpecializations(IndependentFields<int> _1, IndependentFields<bool> _2,
521528
IndependentFields<T1> _3, IndependentFields<std::string> _4,

0 commit comments

Comments
 (0)