[libcxx-commits] [PATCH] D146372: [libc++]Don't warn when using operator<=> with 0
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Mar 19 01:59:20 PDT 2023
philnik added inline comments.
================
Comment at: libcxx/include/__compare/ordering.h:43
struct _CmpUnspecifiedParam {
- _LIBCPP_HIDE_FROM_ABI constexpr
- _CmpUnspecifiedParam(int _CmpUnspecifiedParam::*) noexcept {}
+ _LIBCPP_HIDE_FROM_ABI consteval
+ _CmpUnspecifiedParam(int __literal_zero) noexcept {
----------------
================
Comment at: libcxx/include/__compare/ordering.h:46
+ if (__literal_zero != 0) {
+ __builtin_abort();
+ }
----------------
This produces way better error messages on most compilers: https://godbolt.org/z/PhjaTav68
================
Comment at: libcxx/test/std/language.support/cmp/cmp.categories.pre/zero_type.verify.cpp:1
//===----------------------------------------------------------------------===//
//
----------------
I think this test should be inside `test/libcxx`, since it is very implementation-specific.
================
Comment at: libcxx/test/std/language.support/cmp/cmp.partialord/partialord.pass.cpp:10
// UNSUPPORTED: c++03, c++11, c++14, c++17
+// ADDITIONAL_COMPILE_FLAGS: -Wzero-as-null-pointer-constant
----------------
Is there a reason we can't enable this globally?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146372/new/
https://reviews.llvm.org/D146372
More information about the libcxx-commits
mailing list