BUG: C2352 Error for Reference to Nested Class Member (153801)
The information in this article applies to:
- Microsoft Visual C++ 4.0
- Microsoft Visual C++ 4.1
- Microsoft Visual C++ 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
This article was previously published under Q153801 SYMPTOMS
When you attempt to build the sample code below, you will get an error
message similar to the following:
error C2352: 'A::AA::m' : illegal call of nonstatic member function
CAUSE
This behavior occurs because you are attempting to access a member of a
nested class that has been used as a base class. It is valid to do this.
The compiler should not be reporting an error, and, in this case, the error
that is being reported is misleading.
RESOLUTION
To work around the problem, you can use a typedef to refer to the nested
class that is being used as a base class. This is illustrated in the sample
code below.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. We are researching this problem and will
post new information here in the Microsoft Knowledge Base as it becomes
available.
Modification Type: | Major | Last Reviewed: | 12/8/2003 |
---|
Keywords: | kbBug kbCompiler kbCPPonly kbLangCPP KB153801 |
---|
|