Skip to content

Commit 0ea147b

Browse files
committed
Fixed the generated C# for templated indexers specialised with enums.
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent 8d0db5d commit 0ea147b

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/AST/TypeExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static bool IsPrimitiveType(this Type t, PrimitiveType primitive)
3232

3333
public static bool IsEnumType(this Type t)
3434
{
35-
var tag = t as TagType;
35+
var tag = t.Desugar() as TagType;
3636

3737
if (tag == null)
3838
return false;

tests/CSharp/CSharpTemplates.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,15 +523,22 @@ DependentValueFields<OnlySpecialisedInTypeArg<T>> OnlySpecialisedInTypeArg<T>::r
523523
{
524524
}
525525

526+
enum class UsedInTemplatedIndexer
527+
{
528+
Item1,
529+
Item2
530+
};
531+
526532
// we optimise specialisations so that only actually used ones are wrapped
527533
void forceUseSpecializations(IndependentFields<int> _1, IndependentFields<bool> _2,
528534
IndependentFields<T1> _3, IndependentFields<std::string> _4,
529535
DependentValueFields<int> _5,
530536
VirtualTemplate<int> _6, VirtualTemplate<bool> _7,
531537
HasDefaultTemplateArgument<int, int> _8, DerivedChangesTypeName<T1> _9,
532538
TemplateWithIndexer<int> _10, TemplateWithIndexer<T1> _11,
533-
TemplateWithIndexer<T2*> _12, TemplateDerivedFromRegularDynamic<RegularDynamic> _13,
534-
IndependentFields<OnlySpecialisedInTypeArg<double>> _14, std::string s);
539+
TemplateWithIndexer<T2*> _12, TemplateWithIndexer<UsedInTemplatedIndexer> _13,
540+
TemplateDerivedFromRegularDynamic<RegularDynamic> _14,
541+
IndependentFields<OnlySpecialisedInTypeArg<double>> _15, std::string s);
535542

536543
void hasIgnoredParam(DependentValueFields<IndependentFields<Ignored>> ii);
537544

@@ -551,6 +558,7 @@ template class DLL_API VirtualTemplate<bool>;
551558
template class DLL_API HasDefaultTemplateArgument<int, int>;
552559
template class DLL_API DerivedChangesTypeName<T1>;
553560
template class DLL_API TemplateWithIndexer<int>;
561+
template class DLL_API TemplateWithIndexer<UsedInTemplatedIndexer>;
554562
template class DLL_API TemplateWithIndexer<T1>;
555563
template class DLL_API TemplateWithIndexer<T2*>;
556564
template class DLL_API TemplateDerivedFromRegularDynamic<RegularDynamic>;

0 commit comments

Comments
 (0)