[Bug c++/95536] New: tag name injection doesn't happen for return type of a friend
richard-gccbugzilla at metafoo dot co.uk
gcc-bugzilla@gcc.gnu.org
Thu Jun 4 16:18:36 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95536
Bug ID: 95536
Summary: tag name injection doesn't happen for return type of a
friend
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: richard-gccbugzilla at metafoo dot co.uk
Target Milestone: ---
Testcase:
struct A {
friend struct B *f();
};
B *p;
GCC rejects this saying that 'B' is not declared, which is incorrect -- the
'struct B' introduces the name 'B' into the enclosing non-class scope. GCC gets
this right for
struct A {
friend void f(struct B *);
};
B *p;
so I'd guess that GCC is incorrectly applying the rules for friend class
declarations (eg, 'friend struct B;' does not make 'B' visible outside the
class).
More information about the Gcc-bugs
mailing list