------- 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