llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: disservin (Disservin)

<details>
<summary>Changes</summary>

```
llvm-project/clang/lib/Sema/SemaTemplateVariadic.cpp:1371:16: warning: 
comparison of unsigned expression in ‘&lt; 0’ is always false [-Wtype-limits]
 1371 |     if (*Index &lt; 0 || *Index &gt;= ExpandedExprs.size()) {
      |         ~~~~~~~^~~

llvm-project/clang/lib/Sema/SemaType.cpp:10130:32: warning: comparison of 
unsigned expression in ‘&lt; 0’ is always false [-Wtype-limits]
10130 |     if (FullySubstituted &amp;&amp; (V &lt; 0 || V &gt;= 
Expansions.size())) {
```

https://github.com/llvm/llvm-project/commit/9b132a2ff80dac4bc8e78b242bebb97551c292c7
 changed the types from int64_t to uint64_t so those comparisons are always 
false now

---
Full diff: https://github.com/llvm/llvm-project/pull/207504.diff


2 Files Affected:

- (modified) clang/lib/Sema/SemaTemplateVariadic.cpp (+1-1) 
- (modified) clang/lib/Sema/SemaType.cpp (+1-1) 


``````````diff
diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp 
b/clang/lib/Sema/SemaTemplateVariadic.cpp
index fd1e506aaa895..de5f52f53ec29 100644
--- a/clang/lib/Sema/SemaTemplateVariadic.cpp
+++ b/clang/lib/Sema/SemaTemplateVariadic.cpp
@@ -1368,7 +1368,7 @@ ExprResult Sema::BuildPackIndexingExpr(Expr 
*PackExpression,
   }
 
   if (Index && FullySubstituted) {
-    if (*Index < 0 || *Index >= ExpandedExprs.size()) {
+    if (*Index >= ExpandedExprs.size()) {
       Diag(PackExpression->getBeginLoc(), diag::err_pack_index_out_of_bound)
           << *Index << PackExpression << ExpandedExprs.size();
       return ExprError();
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index fb40ffde00f3d..3640bf00b77a4 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -10127,7 +10127,7 @@ QualType Sema::BuildPackIndexingType(QualType Pattern, 
Expr *IndexExpr,
 
     IndexExpr = Res.get();
     uint64_t V = Value.getZExtValue();
-    if (FullySubstituted && (V < 0 || V >= Expansions.size())) {
+    if (FullySubstituted && V >= Expansions.size()) {
       Diag(IndexExpr->getBeginLoc(), diag::err_pack_index_out_of_bound)
           << V << Pattern << Expansions.size();
       return QualType();

``````````

</details>


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

Reply via email to