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

            Bug ID: 109655
           Summary: Prior friend declaration causes "confused by earlier
                    errors, bailing out" with missing constraint on
                    out-of-class class template member definition
           Product: gcc
           Version: 13.1.0
               URL: https://gcc.godbolt.org/z/dvTbz8vcj
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com
  Target Milestone: ---

class C
{
    template <class>
    requires true
    friend class D;
};

template <class>
requires true
class D {
    void f();
};

template<class T>  // missing "requires true"
void D<T>::f()
{
}

With gcc 13.1, g++ -std=c++20 (or c++2b) produces

'
<source>:15: confused by earlier errors, bailing out

Removing the in-class friend declaration produces a proper error message:

<source>:12:14: error: redeclaration of 'template<class>  requires  true class
D' with different constraints
   12 | void D<T>::f()
      |

Reply via email to