Skip to content

Commit 53dbe11

Browse files
Merge pull request #644 from ds5678/fix-is-type-infinite-recursion
Fix infinite recursion in IsType<T>
2 parents 4a4d01c + 4567ec9 commit 53dbe11

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5521,7 +5521,8 @@ private static bool IsType<T>(Cursor? cursor, Type type, [MaybeNullWhen(false)]
55215521
}
55225522
else if (templateSpecializationType.TemplateName.AsTemplateDecl is TemplateDecl templateDecl)
55235523
{
5524-
if (templateDecl.TemplatedDecl is TypeDecl typeDecl)
5524+
// We exclude InjectedClassNameType here to avoid infinite recursion.
5525+
if ((templateDecl.TemplatedDecl is TypeDecl typeDecl) && (typeDecl.TypeForDecl is not InjectedClassNameType ))
55255526
{
55265527
return IsType(cursor, typeDecl.TypeForDecl, out value);
55275528
}

0 commit comments

Comments
 (0)