================
@@ -11463,6 +11463,23 @@ void 
Sema::CheckExplicitObjectMemberFunction(Declarator &D,
     D.setInvalidType();
   }
 
+  // Handle the following case:
+  //
+  // struct S {
+  //   struct T {
+  //     int f(this T);
+  //   };
+  //
+  //   friend int T::f(this T); // Allow this.
+  //   friend int f(this S);    // But disallow this.
+  // };
+  if (D.getDeclSpec().isFriendSpecified() && D.getCXXScopeSpec().isEmpty()) {
----------------
AaronBallman wrote:

Heh, another terrible test case to consider but should just fall out naturally 
is:
```
struct S {
  int friend func(this T);
};
```

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

Reply via email to