[clang] [clang][Sema] Refine unused-member-function diagnostic message for constructors (PR #84515)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 19 03:44:17 PDT 2024


================
@@ -76,10 +76,33 @@ struct S {
   struct SVS : public VS {
     void vm() { }
   };
+
+  struct CS {
+    CS() {}
+    CS(bool a) {}
+    CS(int b) {} // expected-warning{{unused constructor 'CS'}}
+    CS(float c);
+  };
+
+  struct DCS : public CS {
+    DCS() = default; // expected-warning{{unused constructor 'DCS'}}
+    DCS(bool a) : CS(a) {} // expected-warning{{unused constructor 'DCS'}}
----------------
guillem-bartina-sonarsource wrote:

Yes, you are right, it will always be the same. I left it for consistency with the previous message but I agree that it doesn't provide useful information. Would you prefer the message to be "unused constructor"?

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


More information about the cfe-commits mailing list