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).

Reply via email to