[PATCH] D38455: [clang-tidy] new cppcoreguidelines-narrowing-conversions check.

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 10 00:12:07 PDT 2018


courbet added a comment.

In https://reviews.llvm.org/D38455#1061681, @JonasToth wrote:

> Could you please add some tests that include user defined literals and there interaction with other literals. We should catch narrowing conversions from them, too.


User defined literals do not have this issue: the only accepted signatures are with `long double` or `unsigned long long` parameters. Narrowing cannot happen because `XYZ_ud` actually means `operator""(XYZull)` (same for floats).
(see http://en.cppreference.com/w/cpp/language/user_literal).

I've added a test with a narrowing on the return value.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D38455





More information about the llvm-commits mailing list