[clang] [clang] Reject array comparisons in C++26 for unknown/dependent types in templates (PR #191101)

via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 17 13:48:12 PDT 2026


================
@@ -12487,10 +12487,6 @@ static void diagnoseTautologicalComparison(Sema &S, SourceLocation Loc,
 
   QualType LHSType = LHS->getType();
   QualType RHSType = RHS->getType();
-  if (LHSType->hasFloatingRepresentation() ||
-      (LHSType->isBlockPointerType() && !BinaryOperator::isEqualityOp(Opc)) ||
-      S.inTemplateInstantiation())
-    return;
----------------
PrabbyDD wrote:

Ok i shuffled around some of the code. `diagnoseTautologicalComparison()` should have the previous if statement back without the template check and that plus the other code we mentioned in the meeting should be moved to `checkCompareOperands()`. I am still not sure what to modify regarding it..but that will take some time to understand. 

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


More information about the cfe-commits mailing list