INFO: C4097: Typedef-Name X Used as Synonym for Class-Name Z (113417)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Editions 1.0
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 2.1
- Microsoft Visual C++, 32-bit Editions 2.2
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.2
- Microsoft Visual C++, 32-bit Editions 5.0
This article was previously published under Q113417 SUMMARY
When a typedef class name is used as a base class, the following warning
will appear if compiled with /Ze (enable Microsoft extensions), which is on
by default:
warning C4097:Non-standard extension: typedef-name 'identifier1'
used as synonym for class-name 'identifier2'
If compiled with /Za (disable Microsoft extensions) using Visual C++ for
Windows or Visual C++ 32-bit Edition 1.0, the following error appears:
error C2505: 'identifier' : is not a legal base class
This error message is correct in accordance with the C++ language
specification. In C++ grammar, the "base-list" is specified as being a list
of "base-specifiers". A base-specifier reduces to a "complete-class-name",
which does not include "typedef-names". Consequently, the compiler is
perfectly correct in generating this warning/error for the sample below.
This error is not generated using Visual C++ 32-bit Edition 2.X. Using
Visual C++ 32-bit Edition, versions 2.x and above, the compiler generates
the following warning with both the /Ze and /Za switches:
C4097: typedef-name 'identifier1' used as synonym for class-name
'identifier2'
Modification Type: | Major | Last Reviewed: | 12/2/2003 |
---|
Keywords: | kbCompiler kbCPPonly kbinfo KB113417 |
---|
|