[clang] [libcxx] [SemaCXX] Implement CWG2137 (list-initialization from objects of the same type) (PR #77768)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 12 11:14:34 PST 2024


================
@@ -132,6 +142,36 @@ namespace dr2126 { // dr2126: 12
 #endif
 }
 
+namespace dr2137 { // dr2137: 18
+#if __cplusplus >= 201103L
+  struct Q {
+    Q();
+    Q(Q&&);
+    Q(std::initializer_list<Q>) = delete; // since-cxx11-note 2 {{has been explicitly marked deleted here}}
+  };
+
+  Q x = Q { Q() }; // since-cxx11-error {{call to deleted constructor}}
+
+  int f(Q); // since-cxx11-note {{passing argument to parameter here}}
+  int y = f({ Q() }); // since-cxx11-error {{call to deleted constructor}}
----------------
Endilll wrote:

Can you follow the example of test for CWG2141? Specifically,
1. not trimming diagnostic messages (including identifiers);
2. placing expected errors on the following line (via `// since-cxx11-error at -1`);
3. grouping notes together with errors the same way they are grouped in console output (2170 is a good example how to handle notes that point to a different source line).

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


More information about the cfe-commits mailing list