[clang] [clang] Add tests for some CWG issues from 2024-05-31 telecon (PR #94167)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 3 02:08:47 PDT 2024


================
@@ -180,3 +200,64 @@ void f() {
 
 } // namespace cwg2881
 
+namespace cwg2882 { // cwg2882: 2.7 tentatively ready 2024-05-31
+struct C {
+  operator void() = delete;
+  // expected-warning at -1 {{conversion function converting 'cwg2882::C' to 'void' will never be used}}
+  // cxx98-error at -2 {{deleted function definitions are a C++11 extension}}
+};
+
+void f(C c) {
+  (void)c;
+}
+} // namespace cwg2882
+
+namespace cwg2883 { // cwg2883: no tentatively ready 2024-05-31
+#if __cplusplus >= 201103L
+void f() {
+  int x;
+  (void)[&] {
+    return x;
+  };
+}
+#endif
+#if __cplusplus >= 202002L
+struct A {
+  A() = default;
+  A(const A &) = delete; // #cwg2883-A-copy-ctor
+  constexpr operator int() { return 42; }
+};
+void g() {
+  constexpr A a;
+  // FIXME: OK, not odr-usable from a default template argument, and not odr-used
+  (void)[=]<typename T, int = a> {};
+  // since-cxx20-error at -1 {{call to deleted constructor of 'const A'}}
+  //   since-cxx20-note@#cwg2883-A-copy-ctor {{'A' has been explicitly marked deleted here}}
+}
+#endif
+} // namespace cwg2883
----------------
cor3ntin wrote:

We do emit a diag later https://compiler-explorer.com/z/bd39GcqMP
I think it's still fair  to say it's not implemented

https://github.com/llvm/llvm-project/pull/94167


More information about the cfe-commits mailing list