This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/42328] rejects valid friend
- From: "igodard at pacbell dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Dec 2009 15:20:18 -0000
- Subject: [Bug c++/42328] rejects valid friend
- References: <bug-42328-6594@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from igodard at pacbell dot net 2009-12-08 15:20 -------
Both proposals befriend more than the minimum actually needed by program
semantics. The former befriends any member of freeList<bar, baz>, not just foo;
the latter any member of any freeList at all. In addition, the former requires
that bar be a resolved type. Bar is resolved in the simplified example I
submitted, but in the original baz is itself a template and bar is a class
argument, and you get a diagnostic on a friend of the form of the first
suggestion. That's why the friend is a template, not just freeList<bar, baz> -
the original code was more like:
template<typename U>
class baz : protected freeList<U, baz>,
protected freeList<aType, baz>,
protected freeList<bType, baz>,
< more, where all but U were resolved types >
{
template<typename T>
friend
void freeList<T, baz>::foo();
< body of baz >
};
but was simplified for the report.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42328