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

            Bug ID: 107470
           Summary: GCC falsely accepts friend declaration with
                    mismatching requirements
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: h2+bugs at fsfe dot org
  Target Milestone: ---

#include <concepts>

template <std::integral T>
    requires std::unsigned_integral<T>
struct S
{
    template <std::integral T2> // template <typename T2>
    friend class S;
};

int main()
{
    S<unsigned> s;
}


The code is accepted by GCC and rejected by clang. However, if the friend
declaration is fully unconstrained, it is also rejected by GCC.

Code like this exists in libstdc++ which clang stumbles over (I will create a
separate library issue for that).

Reply via email to