================
@@ -24,6 +44,103 @@ using enum E;
#endif
}
+namespace cwg2627 { // cwg2627: 19
+#if __cplusplus >= 202002L
+struct C {
+ long long i : 8;
+ friend auto operator<=>(C, C) = default;
+};
+
+void f() {
+ C x{1}, y{2};
+ static_cast<void>(x <=> y);
+ static_cast<void>(x.i <=> y.i);
+}
+
+template<typename T>
+struct CDependent {
+ T i : 8;
+ friend auto operator<=>(CDependent, CDependent) = default;
+};
+
+template<typename T>
+concept three_way_comparable = requires(T t) { { t <=> t }; };
+template<typename T>
+concept bf_three_way_comparable = requires(T t) { { t.i <=> t.i }; };
+static_assert(three_way_comparable<CDependent<long long>>);
+static_assert(bf_three_way_comparable<CDependent<long long>>);
+#endif
+
+#if __cplusplus >= 201103L
+template<int W>
+struct D {
+ __int128 i : W;
----------------
MitalAshok wrote:
Bit-fields with width less than 32 are automatically promoted to `int`
(https://stackoverflow.com/a/32529155), so if we tried `int64_t` and `int32_t`
it would already work because of the promotion: https://godbolt.org/z/oMxE7oq31
(Also that might have been a clang bug because either that integral promotion
shouldn't happen or it should have technically counted as narrowing before this
DR because it is an implicit conversion that is narrowing via
https://eel.is/c++draft/dcl.init.list#7.4.2)
So we need two types wider than `int`, and with a 32 bit int, that means a 64
bit and 128 bit type (Or a `_BitInt(33)` and `_BitInt(34)`, but that's also an
extension in C++)
https://github.com/llvm/llvm-project/pull/78112
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits