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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2022-04-11
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot 
gnu.org
                 CC|                            |ppalka at gcc dot gnu.org
     Ever confirmed|0                           |1
      Known to fail|                            |10.3.0, 11.2.0, 12.0

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed, reduced rejects-valid testcase:

template<class T>
concept fooable = requires(T t) { t.foo(); };

template<class>
struct A;        // #1

template<fooable T>
struct A<T> { }; // #2

struct B {
private:
  friend struct A<B>;
  void foo();
};

A<B> a; // should use #2


When determining whether to use #1 or #2 for A<B>, we check #2's constraints in
the context of the template rather than the context of the specialization, so
the friend declaration doesn't apply.  Thus one workaround is to declare a
template friend instead:

  template<class> friend struct A;

Reply via email to