dotnet / dotnet/ClangSharp

win-arm64 libClangSharp 22.1.8.2 returns invalid CX_TemplateName for dependent specialization bases

Open
#806 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.3k
Forks
187
Avg merge
6d 19h
Merged PRs (30d)
1

Description

The `libClangSharp.runtime.win-arm64` 22.1.8.2 native returns an invalid `CX_TemplateName` (`kind == CX_TNK_Invalid`) for the canonical `TemplateSpecializationType` of a dependent specialization base, e.g. `Base` used as a base within a class template:

```cpp
template struct Base { int value; };
template struct Derived : Base {};
```

On every other RID (win-x64, linux-x64, linux-arm64, osx-arm64) the same input resolves the base to a valid `ClassTemplateDecl`. Only `win-arm64` produces an invalid template name, which tripped `TranslationUnit.GetOrCreate(CX_TemplateName)`'s `Debug.Fail("Unsupported template name encountered.")` (and would NRE in Release). This surfaced as 8 `DependentTemplateBaseTest` failures exclusive to the win-arm64 debug CI leg on #805.

This looks like a win-arm64-specific native packaging/build defect (same class of problem as the mispackaged `libClangSharp.runtime.win-x64` 22.1.8.1 that shipped clang 21). The generator now falls back to resolving the base through the referenced `ClassTemplateDecl` so the invalid template name no longer breaks generation, but the underlying native should be verified/repackaged so `Type_getTemplateName` behaves consistently across all RIDs.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.