================
@@ -0,0 +1,43 @@
+.. title:: clang-tidy - modernize-use-aggregate
+
+modernize-use-aggregate
+=======================
+
+Finds classes and structs that could be aggregates if their trivial
+forwarding constructors were removed.
+
+A constructor is considered a trivial forwarder when it takes one
+parameter per non-static data member, initializes each member from the
+corresponding parameter in declaration order, and has an empty body.
+Removing such constructors enables aggregate initialization and, in
+C++20, designated initializers.
+
+.. code-block:: c++
+
+  // Before
+  struct Point {
+    int X;
+    int Y;
+    Point(int X, int Y) : X(X), Y(Y) {}
+  };
+
+  Point p(1, 2);
+
+  // After -- remove the constructor
+  struct Point {
+    int X;
+    int Y;
+  };
+
+  Point p{1, 2};          // aggregate initialization
----------------
EugeneZelenko wrote:

```suggestion
  Point p{1, 2};           // aggregate initialization
```

https://github.com/llvm/llvm-project/pull/182061
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to