https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125340
Bug ID: 125340
Summary: undiagnosed friend inline non-definition declaration
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: aoliva at gcc dot gnu.org
Target Milestone: ---
// { dg-do compile }
inline void bar();
class foo {
friend inline void bar(); // ok, already declared inline
friend inline void bad(); // { dg-error "missing definition" }
};
[dcl.fct.spec]/3 in C++11, later moved to [dcl.inline]:
If the inline specifier is used in a friend function declaration, that
declaration shall be a definition or the function shall have previously been
declared inline.
Curiously, g++.dg/template/friend65.C catches this within a template class
body, referencing a specialization of a template function.
gcc/testsuite/g++.dg/opt/const2.C has such an ill-formed friend inline
non-definition declaration.