[clang] [clang] Avoid crash due to unimplemented StructuralValue support in the template differ (PR #93265)

Andrey Ali Khan Bolshakov via cfe-commits cfe-commits at lists.llvm.org
Fri May 24 02:51:38 PDT 2024


================
@@ -1265,13 +1238,62 @@ class TemplateDiff {
         IsNullPtr = true;
         return;
       case TemplateArgument::Expression:
-        // TODO: Sometimes, the desugared template argument Expr differs from
-        // the sugared template argument Expr.  It may be useful in the future
-        // but for now, it is just discarded.
-        if (!E)
-          E = TA.getAsExpr();
-        return;
+        E = Iter->getAsExpr();
+        break;
+      case TemplateArgument::Null:
+      case TemplateArgument::Type:
+      case TemplateArgument::Template:
+      case TemplateArgument::TemplateExpansion:
+        llvm_unreachable("TemplateArgument kind is not expected for NTTP");
+      case TemplateArgument::Pack:
+        llvm_unreachable("TemplateArgument kind handled elsewhere");
----------------
bolshakov-a wrote:

Nit: "... _should be_ handled ..."?

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


More information about the cfe-commits mailing list