pfultz2 added inline comments.

================
Comment at: clang-tools-extra/clang-tidy/bugprone/EnumToIntCheck.cpp:45
+  } else {
+    Note << FixItHint::CreateInsertion(MatchedExpr->getBeginLoc(), "(int)");
+  }
----------------
carlosgalvezp wrote:
> I don't think we can assume the type of the enum is `int`, see for example:
> 
> ```
> enum Foo : unsigned int
> {
>     a,
>     b
> };
> 
> 
> void f(unsigned int);
> 
> int main()
> {
>     f(a);
> }
> 
> ```
> 
> Even if there is no explicit underlying type, isn't the underlying type 
> implementation-defined?
Since its an explicit cast then we should probably use the type that the 
function accepts(since thats what it will be eventually converted to)  rather 
than the type of the underling enum type.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129570/new/

https://reviews.llvm.org/D129570

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to