================
@@ -7617,9 +7617,13 @@ 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))) {
----------------
MitalAshok wrote:

That's checked somewhere later, this was operating on `ThisType`.

For an implicit object member function, 
`ThisType.getNonReferenceType().getUnqualifiedType()` is *always* 
`Context.getRecordType(RD)` (and this shouldn't fail anyways because the 
diagnostic emitted here is 
`err_defaulted_special_member_explicit_object_mismatch`)

The only difference is with explicit object member functions. The old code 
rejected `S& S::operator=(this int, const S&) = default;`, but accepted `S& 
S::operator=(this S, const S&)` since it didn't check that it was a reference.

https://github.com/llvm/llvm-project/pull/100419
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to