================
@@ -2653,23 +2653,11 @@ DeduceTemplateArguments(Sema &S, TemplateParameterList 
*TemplateParams,
       switch (A.getKind()) {
       case TemplateArgument::Expression: {
         const Expr *E = A.getAsExpr();
-        // When checking NTTP, if either the parameter or the argument is
-        // dependent, as there would be otherwise nothing to deduce, we force
-        // the argument to the parameter type using this dependent implicit
-        // cast, in order to maintain invariants. Now we can deduce the
-        // resulting type from the original type, and deduce the original type
-        // against the parameter we are checking.
-        if (const auto *ICE = dyn_cast<ImplicitCastExpr>(E);
-            ICE && ICE->getCastKind() == clang::CK_Dependent) {
+        // The type of the value is the type of the expression before any
+        // implicit conversions.
+        if (const auto *ICE = dyn_cast<ImplicitCastExpr>(E)) {
           E = ICE->getSubExpr();
-          if (auto Result = DeduceTemplateArgumentsByTypeMatch(
-                  S, TemplateParams, ICE->getType(), E->getType(), Info,
-                  Deduced, TDF_SkipNonDependent,
-                  PartialOrdering ? PartialOrderingKind::NonCall
-                                  : PartialOrderingKind::None,
-                  /*DeducedFromArrayBound=*/false, HasDeducedAnyParam);
-              Result != TemplateDeductionResult::Success)
-            return Result;
+          assert(!isa<ImplicitCastExpr>(E));
----------------
erichkeane wrote:

Yeah, it seems reasonable for an implicit cast to contain another implicit cast 
(I think I've seen that quite a bit?).  SO I think this just needs to be `E = 
E->IgnoreImpCasts()` (and maybe paren casts too?).

https://github.com/llvm/llvm-project/pull/160433
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to