[clang] [Clang] Diagnose defaulted assignment operator with incompatible object parameter (PR #70176)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 25 01:23:37 PDT 2023


github-actions[bot] wrote:


<!--LLVM CODE FORMAT COMMENT: {clang-format}-->

:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff a7700985577694d6cc2498833f27b4fb5eeaf252 441f24714729f35588487d3109e3c42d59e0a610 -- clang/lib/Sema/SemaDeclCXX.cpp clang/test/SemaCXX/cxx2b-deducing-this.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 35554fca5776..fb27168f7d2a 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -7754,11 +7754,14 @@ bool Sema::CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD,
     // parameter is of (possibly different) type “reference to C”,
     // in which case the type of F1 would differ from the type of F2
     // in that the type of F1 has an additional parameter;
-    if(!Context.hasSameType(ThisType.getNonReferenceType().getUnqualifiedType(), Context.getRecordType(RD))) {
+    if (!Context.hasSameType(
+            ThisType.getNonReferenceType().getUnqualifiedType(),
+            Context.getRecordType(RD))) {
       if (DeleteOnTypeMismatch)
         ShouldDeleteForTypeMismatch = true;
       else {
-        Diag(MD->getLocation(), diag::err_defaulted_special_member_explicit_object_mismatch)
+        Diag(MD->getLocation(),
+             diag::err_defaulted_special_member_explicit_object_mismatch)
             << (CSM == CXXMoveAssignment) << RD;
         HadError = true;
       }

``````````

</details>


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


More information about the cfe-commits mailing list