[PATCH] D33470: [clang-tidy] Add misc-default-numerics
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 5 06:38:41 PDT 2017
aaron.ballman added inline comments.
================
Comment at: test/clang-tidy/misc-default-numerics.cpp:28
+struct numeric_limits<SpecializedType> {
+ static int min() { return -1; }
+ static SpecializedType max() { return SpecializedType(); }
----------------
This is not a proper specialization according to the standard.
> A program may add a template specialization for any standard library template to namespace std only if the declaration depends on a user-defined type and the specialization meets the standard library requirements for the original template and is not explicitly prohibited.
The functions are not marked `constexpr` or `noexcept`, and `min()` must return `SpecializedType`. Also the `is_specialized` member needs to be set to `true`. There are other requirements missing as well, but I think fixing the function signatures is the only important one.
https://reviews.llvm.org/D33470
More information about the cfe-commits
mailing list