[clang] [Sema] Fix crash on invalid operator template-id (PR #181404)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 15 09:37:07 PST 2026
================
@@ -6101,7 +6101,17 @@ Sema::GetNameFromUnqualifiedId(const UnqualifiedId &Name) {
}
case UnqualifiedIdKind::IK_TemplateId: {
+ if (!Name.TemplateId)
+ return DeclarationNameInfo();
+
+ if (Name.TemplateId->isInvalid())
+ return DeclarationNameInfo();
+
TemplateName TName = Name.TemplateId->Template.get();
+
+ if (TName.isNull())
+ return DeclarationNameInfo();
----------------
nehaGautam07 wrote:
Thanks for the suggestion.
After re-verifying, getNameForTemplate() can be invoked with an invalid template-id, leading to a crash. Guarding on Name.TemplateId->isInvalid() prevents this while keeping the change minimal.
https://github.com/llvm/llvm-project/pull/181404
More information about the cfe-commits
mailing list