[PATCH] D155586: avoid sign-conversion-error in erase

Paul via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 18 05:35:08 PDT 2023


JazzSuite created this revision.
JazzSuite added a reviewer: 0-wiz-0.
Herald added a project: All.
JazzSuite requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

As it is now i ran into this problem: "error: conversion to 'std::size_t' {aka 'long long unsigned int'} from 'long long int' may change the sign of the result [-Werror=sign-conversion]"


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155586

Files:
  llvm/include/llvm/ADT/SmallVector.h


Index: llvm/include/llvm/ADT/SmallVector.h
===================================================================
--- llvm/include/llvm/ADT/SmallVector.h
+++ llvm/include/llvm/ADT/SmallVector.h
@@ -764,7 +764,7 @@
     iterator I = std::move(E, this->end(), S);
     // Drop the last elts.
     this->destroy_range(I, this->end());
-    this->set_size(I - this->begin());
+    this->set_size(static_cast<size_type>(I - this->begin()));
     return(N);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155586.541469.patch
Type: text/x-patch
Size: 456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230718/c10c616f/attachment.bin>


More information about the llvm-commits mailing list