gchatelet added inline comments.

================
Comment at: clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp:58
+                       const QualType Rhs) {
+  assert(Lhs->isRealType());     // Either integer or floating point.
+  assert(Rhs->isFloatingType()); // Floating point only.
----------------
JonasToth wrote:
> gchatelet wrote:
> > JonasToth wrote:
> > > Couldn't be the conversion from an `int` to an `enum` be considered 
> > > narrowing as well? (Not sure about the word of the standard) I think it 
> > > makes sense to change the `assert` to `return false`
> > This is a good point but I'd like to implement this as a second patch if 
> > you don't mind.
> > I created this bug to track it:
> > https://bugs.llvm.org/show_bug.cgi?id=39401
> Implementing this in a follow-up is no problem, but could such a case trigger 
> the assertion by any means?
Not right now because the matchers do not pick integers for the RHS so it never 
matches int to enum conversions.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53488



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

Reply via email to