[clang] [clang][Sema] fix crash on __type_pack_element with dependent packs (GH180307) (PR #180407)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 9 02:13:58 PST 2026
================
@@ -3406,6 +3406,10 @@ static QualType checkBuiltinTemplateIdType(
Sema &SemaRef, ElaboratedTypeKeyword Keyword, BuiltinTemplateDecl *BTD,
ArrayRef<TemplateArgument> Converted, SourceLocation TemplateLoc,
TemplateArgumentListInfo &TemplateArgs) {
+ if (llvm::any_of(Converted,
+ [](const TemplateArgument &A) { return A.isDependent(); }))
+ return QualType();
----------------
ojhunt wrote:
Oh huh, I wouldn't have thought of doing it this way. Good call.
Are we able to check that the minimum arg count is reached? e.g
```cpp
__some_builtin_template<{some template parameter set}>(...)
```
is always invalid if there are insufficient template parameters (assuming no packs), e.g we can error out on incorrect/insufficient template parameters even if they are dependent
https://github.com/llvm/llvm-project/pull/180407
More information about the cfe-commits
mailing list