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

            Bug ID: 122258
           Summary: ICE on invalid friend declaration with an explicit
                    object parameter
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: corentinjabot at gmail dot com
  Target Milestone: ---

GCC crashes on the following invalid code involving an invalid friend
declaration of a function with an explicit object parameter


struct type {
    template <unsigned I, class Self>
    friend // obviously invalid but ice gcc
        auto get(this Self &&self);
};

int main() {
    // auto [a] = type();
    get<0>(type());
}

Another (also invalid) scenario involving structured binding - which may have
the same root cause https://godbolt.org/z/drb9nG1TT

Reply via email to