This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/62101] New: deleted definitions of friend functions are rejected
- From: "ville.voutilainen at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 12 Aug 2014 00:26:01 +0000
- Subject: [Bug c++/62101] New: deleted definitions of friend functions are rejected
- Auto-submitted: auto-generated
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.