[clang] [Clang] Disallow explicit object parameters in more contexts (PR #89078)
via cfe-commits
cfe-commits at lists.llvm.org
Tue May 28 11:28:07 PDT 2024
================
@@ -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()) {
----------------
Sirraide wrote:
I’m candidly not sure anymore; I’ll add a test for that if there isn’t already one.
https://github.com/llvm/llvm-project/pull/89078
More information about the cfe-commits
mailing list