FIX: Nested Macros Cause Errors C2065 and C2064Last reviewed: September 19, 1997Article ID: Q164947 |
The information in this article applies to:
SYMPTOMSA nested macro may cause errors similar to the following:
error C2065: 'MACRO_B' : undeclared identifier error C2064: term does not evaluate to a function error C2143: syntax error : missing ';' before '}' CAUSEThe second macro is not being expanded correctly. A preprocessed file for the following sample shows that MACRO_B is not expanded:
{ MACRO_B ("Hello world.\n") };It should expand to:
{ { printf("Hello world.\n"); } }; STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ 32-bit Edition, versions 4.2.
MORE INFORMATION
Sample Code
/* Compile options needed: none */ #include <stdio.h> #define MACRO_A(A) { MACRO_B A } #define MACRO_B(A) { printf(A); } void main() { MACRO_A(("Hello world.\n")); } Keywords : CLIss CodeGen kbtool kbbuglist kbfixlist vcbuglist400 vcbuglist420 Component : C/C++ Compiler Version : 4.0 4.1 Platform : NT WINDOWS Issue type : kbbug Solution Type : kbfix |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |