[PATCH] D118034: [C++20] [Modules] Don't complain about duplicated default template argument across modules

Nathan Sidwell via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 16 06:54:22 PST 2022


urnathan added inline comments.


================
Comment at: clang/lib/Sema/SemaTemplate.cpp:2654-2656
+    if (!C.hasSameType(DefaultArgumentX->getType(),
+                       DefaultArgumentY->getType()))
+      return false;
----------------
Can this ever trigger and the below expression test not trigger, given the above type comparison?


================
Comment at: clang/lib/Sema/SemaTemplate.cpp:2658-2682
+    Expr::EvalResult EVRX, EVRY;
+    if (!DefaultArgumentX->EvaluateAsConstantExpr(EVRX, C) ||
+        !DefaultArgumentY->EvaluateAsConstantExpr(EVRY, C))
+      return false;
+
+    APValue VX = EVRX.Val, VY = EVRY.Val;
+    if (VX.getKind() != VY.getKind())
----------------
I'm kind of surprised how complex this check is.  Isn't there an AST comparator available somewhere?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118034/new/

https://reviews.llvm.org/D118034



More information about the cfe-commits mailing list