[clang] [Sema] Fix crash on invalid operator template-id (PR #181404)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 13 20:00:50 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();
----------------
zwuis wrote:

Please explain why we need three `if` here, and please remove unnecessary `if` until finding reproducers.

https://github.com/llvm/llvm-project/pull/181404


More information about the cfe-commits mailing list