================
@@ -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;
----------------
Endilll wrote:

Bear we me some more.
So you currently have the following tests that I presume test 
https://eel.is/c++draft/dcl.init.list#7.4.1 both positively and negatively:
```cpp
int64_t d1{ d<__int128, 63>().i }; // int64_t can represent all the values of a 
hypothetical 63-bit signed type, goo
int64_t d2{ d<__int128, 64>().i }; // same for 64 bits, good
int64_t d3{ d<__int128, 65>().i }; // 65 bits, 1 bit more that int64_t can 
represent
```
Why can't we "downgrade" this to
```cpp
int32_t d1{ d<int64_t, 31>().i };
int32_t d2{ d<int64_t, 32>().i };
int32_t d3{ d<int64_t, 33>().i };
```
Presumably this should yield the same result when 
https://eel.is/c++draft/dcl.init.list#7.4.1 is considered.

https://github.com/llvm/llvm-project/pull/78112
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to