Reproducer:
void f() {
struct A {
friend void foo() {}
};
}
compiled with --std=gnu++23.
clang-19.1.0:
<source>:3:21: error: no matching function found in local scope
3 | friend void foo() {}
| ^~~
1 error generated.
gcc-14-2:
<source>: In function 'void f()':
<source>:3:21: error: cannot define friend function 'foo' in a local class definition
3 | friend void foo() {}
| ^~~