https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118507

            Bug ID: 118507
           Summary: Erroneous 'invalid use of qualified-name' for member
                    function defined with 'typedef' in a friend
                    declaration
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rush102333 at gmail dot com
  Target Milestone: ---

The following code fails in the process of name lookup:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

typedef void X();
class a
{
 public:
   X x;
};

class b
{
   friend X a::x;
};

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GCC rejects it with:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

<source>:10:13: error: invalid use of qualified-name 'a::x'
   10 |    friend X a::x;
      |             ^

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note that clang, MSVC and EDG can normally accept it:

https://godbolt.org/z/WvKaKbM33

Reply via email to