Issue 143927
Summary [clang-tidy] Crash with modernize-use-integer-sign-comparison
Labels clang-tidy
Assignees
Reporter VReichelt
    Running clang-tidy with -checks='-*,modernize-use-integer-sign-comparison' and '-std=c++20' (or above) on the code 

```
struct A
{
  unsigned size() const;
};

struct B
{
  A a;

  bool foo(const A& a2) const { return (int)a2.size() == size();  }
  int size() const { return (int)a.size(); }
};
```

triggers an assertion: `clang-tidy: /tmp/LLVM/llvm-project/clang-tools-extra/clang-tidy/modernize/UseIntegerSignComparisonCheck.cpp:123: virtual void clang::tidy::modernize::UseIntegerSignComparisonCheck::check(const clang::ast_matchers::MatchFinder::MatchResult&): Assertion 'SignedCastExpression' failed.`

This was introduced in the last two weeks, so I suspect this is due to the fix for #127471 .

@RiverDave , @vbvictor : Could you please have a look?

[Stacktrace.txt](https://github.com/user-attachments/files/20712795/Stacktrace.txt)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to