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

            Bug ID: 91609
           Summary: friend declaration not honoured
           Product: gcc
           Version: 9.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jobstz at posteo dot de
  Target Milestone: ---

Created attachment 46791
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46791&action=edit
minimal example

gcc does not honour the friend declaration and produces the error message:

test.cpp:16:9: error: ‘result’ does not name a type
   16 |  friend result;
      |         ^~~~~~
test.cpp: In instantiation of ‘class complicated<int, traits_template>’:
test.cpp:21:36:   required from here
test.cpp:9:7: error: ‘using type = int’ is private within this context
    9 | class complicated : underlying_thing<typename TraitsTemplate<T>::type>
{};
      |       ^~~~~~~~~~~
test.cpp:13:8: note: declared private here
   13 |  using type = T;
      |        ^~~

clang happily accepts the code.
Possibly related: #82613
Metabug: #59002

Reply via email to