[Bug c++/61470] New: ill-formed friend declaration(s) with default-arguments not caught
filip.roseen at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jun 11 10:39:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61470
Bug ID: 61470
Summary: ill-formed friend declaration(s) with
default-arguments not caught
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: filip.roseen at gmail dot com
Created attachment 32920
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32920&action=edit
testcase.cpp
struct A {
friend void f(int=0); // (A), ill-formed, [dcl.fct.default]p4
friend void g(int=0){}; // ( ), legal
};
void g(int); // (B), ill-formed, [dcl.fct.default]p4
int main () { }
---------------------
(A) and (B) are violating the following sentence from [dcl.fct.default]p4:
> If a friend declaration specifies a default argument expression, that
> declaration shall be a definition and shall be the only declaration of
> the function or function template in the translation unit.
More information about the Gcc-bugs
mailing list