FIX: Typedef Type Causes C2275: Illegal Use of Type (166513)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 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 Q166513 SYMPTOMS
Using a typedef cast in the member initialization of a class may cause the
following errors:
error C2275: 'test::run' : illegal use of this type as an expression
error C2146: syntax error : missing ')' before identifier 'arg'
error C2612: trailing '.*|->*' illegal in base/member initializer list
error C2059: syntax error : ')'
error C2143: syntax error : missing ';' before '{'
fatal error C1004: unexpected end of file found
RESOLUTION
Use the actual type rather then the typedef. For example, in the following
sample use test::run rather than test_run. Or, use the functional notation
test_run (arg) for type conversion instead of the cast notation. Another
option is to initialize the member in the body of function.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was corrected in Microsoft Visual C++ version 6.0.
Modification Type: | Minor | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbBug kbfix kbVC600fix KB166513 |
---|
|