https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101356
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2021-08-02 00:00:00 |2021-12-13
Blocks| |65608
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
When we do friend void ::show(); we get the following warning:
<source>: In function 'auto fun()':
<source>:5:21: warning: 'void show()' has not been declared within '::'
5 | friend void ::show();
| ^~
<source>:3:10: note: only here as a 'friend'
3 | void show();
| ^~~~
And even this is rejected:
namespace A {
void show();
}
auto fun(){
struct C{
friend void A::show();
private:
int c;
};
return C{};
}
void A::show(){
auto o = fun();
o.c = 0;
}
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65608
[Bug 65608] [meta-bug] friend issues