The information in this article applies to:
SYMPTOMSDeclaring a template parameter type as a friend class of a template class, causes the compiler error C2248: Member access is not granted to friend class T, where T is a template parameter of the template class XX. CAUSEThe compiler treats typename T as a regular C++ class and not a template parameter type. This implies the following:
RESOLUTIONDo not declare a template parameter type as a friend of a template class. Specify the friend class using the regular C++ class name. STATUSThis behavior is by design as per C++ standard section 7.1.5.3 paragraph 2. MORE INFORMATIONThe following sample code demonstrates the problem. Sample Code
Additional query words:
Keywords : kberrmsg kbtool kbCompiler kbCPPonly kbLangCPP kbVC kbVC500 kbVC600 |
Last Reviewed: May 18, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |