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

            Bug ID: 62101
           Summary: deleted definitions of friend functions are rejected
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ville.voutilainen at gmail dot com

Test:

struct X
{
    friend void f(X, int) = delete;
    friend void f(X, double) {}
};

struct Y;
void g(Y, int);
void g(Y, double);

struct Y
{
    friend void g(Y, int) = delete;
    friend void g(Y, double) {}
};

int main()
{
    X x;
    f(x, 5.0);
    Y y;
    g(y, 5.0);
}

deleted-friend.cpp:3:26: error: can’t initialize friend function ‘f’
  friend void f(X, int) = delete;
                          ^
deleted-friend.cpp:13:26: error: can’t initialize friend function ‘g’
  friend void g(Y, int) = delete;
                          ^

clang accepts the code. There doesn't seem to be any standard wording
forbidding in-class friend definitions that are deleted.

Reply via email to