BUG: ATL consumer templates do not compile when you use the CArrayRowset class in Visual C++ .NET or in Visual C++ 2005 (828558)
The information in this article applies to:
- Microsoft Visual C++ 2005 Express Edition
- Microsoft Visual C++ .NET (2003)
- Microsoft Visual C++ .NET (2002)
SYMPTOMSThe CCommand class of Microsoft ATL (Active Template Library) provides methods
to set a command and to execute a command. However, in the CCommand ATL consumer template, when you define the TRowset parameter as CArrayRowset, and you use Microsoft Visual C++ .NET or Microsoft Visual C++ 2005 to compile your code, you may
receive following compiler error message: error
C3200: 'ATL::CArrayRowset<TAccessor>' : invalid template argument for
template parameter 'TRowset', expected a class template with [
TAccessor=CUserDataAccessor ] see reference to class template
instantiation 'ATL::CCommand<TAccessor,TRowset>' being compiled
with [ TAccessor=ATL::CAccessor<CUserDataAccessor>,
TRowset=ATL::CArrayRowset<CUserDataAccessor> ] Note In Microsoft Visual C++ 6.0, you do not receive this
compiler error. WORKAROUNDTo work around this problem, change the definition of the CCommand ATL consumer template from the following CCommand< CAccessor<CUserDataAcc>, CArrayRowset<CUserDataAcc> > cmd; to the following: CCommand< CAccessor<CUserDataAccessor>, CArrayRowset > cmd; To do this, follow these steps:
- In Solution Explorer, double-click ATLCommand.cpp under the Source Files
folder.
- Locate the following code in the main
function:
CCommand< CAccessor<CUserDataAccessor>, CArrayRowset<CUserDataAccessor> > cmd; - Replace the code that you located in step 2 with the
following code:
// This definition is broken in Visual Studio .NET 2002 and in Visual Studio .NET 2003.
// CCommand< CAccessor<CUserDataAccessor>, CArrayRowset<CUserDataAccessor> > cmd;
// The following statement represents the workaround:
CCommand< CAccessor<CUserDataAccessor>, CArrayRowset > cmd; - Press the CTRL+SHIFT+B key combination to build the
code.
Notice that the code compiles without any errors.
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are
listed at the beginning of this article.
REFERENCESFor more information about the CCommand class, visit the following Microsoft Web
site: For more information about the CArrayRowset class, visit the following Microsoft Web
site:
Modification Type: | Major | Last Reviewed: | 1/12/2006 |
---|
Keywords: | kbtemplate kbbug KB828558 kbAudDeveloper |
---|
|