This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/45942] class will not get friends with another class
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 8 Oct 2010 14:41:39 +0000
- Subject: [Bug c++/45942] class will not get friends with another class
- Auto-submitted: auto-generated
- References: <bug-45942-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45942
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-08 14:41:28 UTC ---
It's not entirely clear what you're saying is a bug, because your testcase
doesn't give any error.
It's more helpful to provide the source code that you claim produces the bug.
I assume you this:
template <class T, int C> class classA;
template <class T, int C, classA<T,C> &instanceA> class classB;
template <class T, int C> class classA
{
// incorrect error message: partial specialization claimed but not apparent
template <classA &instanceA> friend class classB<T,C,instanceA>;
private:
int for_use_by_classB;
};
template <class T, int C, classA<T,C> &instanceA> class classB
{
classB (int i) { instanceA.for_use_by_classB = i; }
};
// instantiation
template class classA<char,128>;
That code is not valid, the error is not incorrect.
You have declared classB as a friend, and as a template with one template
parameter, instanceA, and the template arguments <T,C,instanceA>. That is a
partial specialization.