Home Dashboard Directory Help
Search

Parser error in Visual C++ Development Environment by RaminHalavati


Status: 

Closed
 as Deferred Help for as Deferred


1
0
Sign in
to vote
Type: Bug
ID: 767290
Opened: 10/12/2012 9:27:44 PM
Access Restriction: Public
1
Workaround(s)
view
0
User(s) can reproduce this bug

Description

If you write the following code, when you click on the code after FOR_ALL macro in function _tmain, the parser shows FOR_ALL as active function and all activities regarding selecting functions and scopes are disrupted.

#define FOR_ALL( VEC , pVAR ) for ( decltype( ( VEC ).begin() ) pVAR = ( VEC ).begin() ; pVAR != ( VEC ).end() ; pVAR++ )

int _tmain(int argc, _TCHAR* argv[])
{
vector<long> theList ;

FOR_ALL( theList , pItem )
{ cout << * pItem << "\n" ;}

return 0;
}
Details
Sign in to post a comment.
Posted by Microsoft on 10/14/2012 at 7:33 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Microsoft Visual Studio Connect Support Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 10/12/2012 at 10:02 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by RaminHalavati on 10/12/2012 at 9:31 PM
If I add an extra parameter to the function and use a constant number as that parameter, the problem is resolved:

e.g.:
#define FOR_ALL( VEC , pVAR , TEMP ) for ( decltype( ( VEC ).begin() ) pVAR = ( VEC ).begin() ; pVAR != ( VEC ).end() ; pVAR++ )

and use FOR_ALL( theList , pItem , 0 )

also, if I don't have "for" in macro definition, the problem does not happen:

#define FOR_ALL( VEC , pVAR ) ( decltype( ( VEC ).begin() ) pVAR = ( VEC ).begin() ; pVAR != ( VEC ).end() ; pVAR++ )

and use for FOR_ALL( theList , pItem )
File Name Submitted By Submitted On File Size  
Screenshot.png 10/12/2012 37 KB