https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90572
Bug ID: 90572
Summary: Wrong disambiguation in friend declaration as implicit
typename context
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: blitzrakete at gmail dot com
Target Milestone: ---
template <typename T> struct C {
friend C(T::fn)(); // not implicit typename context, declarator-id of friend
// declaration
};
Courtesy of rsmith. gcc fails to compile this with -std=c++2a, but accepts it
in C++17 mode.
<source>:11:19: error: ISO C++ forbids declaration of 'C' with no type
[-fpermissive]
11 | friend C(T::fn)(); // not implicit typename context, declarator-id
of friend
| ^
<source>:11:19: error: 'C' declared as function returning a function
gcc interprets this as a function taking a T::fn and returning a function,
while it should be a function returning C taking no parameters with the
(qualified) name T::fn.