In VS2005 paste following code into CPP file:
// cppConsole.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#define TEST_MACRO
#if defined(TEST_MACRO)
#include <iostream>
#include <locale>
#endif
#if defined(TEST_MACRO)
static int haha_hoho()
{
return 0;
}
template< typename T >
struct is_int{
static const bool value = false;
};
template<>
struct is_int< int >{
static const bool value = true;
};
template<>
struct is_int< int* >{
static const bool value = true;
};
template <typename IVal>
IVal max_signed()
{
IVal new_val;
memset(&new_val, -1, sizeof(IVal));
return new_val / 2;
}
static int zz(const char *aa, const char *bb, int cc = 1, int dd = 1, const std::locale & loc = std::locale())
{
char pc, sc;
while (true)
{
pc = cc ? std::tolower(*bb, loc) : *bb;
if (
(pc == '\\0' && *aa != '\\0') ||
(*aa == '\\0' && pc != '%' ))
return 0;
if (pc == '%')
{
while (*bb == '%')
++bb;
pc = cc ? std::tolower(*bb, loc) : *bb;
if (pc == '\\0')
break;
while (true)
{
if (pc != '_' && pc != '\\\\')
{
while (*aa)
{
sc = cc ? std::tolower(*aa, loc) : *aa;
if (sc == pc)
break;
++aa;
}
}
if (zz(aa, bb, dd))
return 1;
if (*aa == '\\0')
return 0;
sc = cc ? std::tolower(*aa, loc) : *aa;
++aa;
}
}
if (pc == '_')
{
bb++;
aa++;
continue;
}
// osetrenie escape
if (
dd && pc == '\\\\' &&
(bb[1] == '\\\\' || bb[1] == '%' || bb[1] == '_'))
{
++bb;
pc = cc ? std::tolower(*bb, loc) : *bb;
}
sc = cc ? std::tolower(*aa++, loc) : *aa++;
++bb;
if (sc != pc)
return 0;
}
return -1;
}
int _tmain(int argc, _TCHAR* argv[])
{
// here must not be any statement!!!
std::string str; // try to add include for str
return 0;
}
#endif
Focus on function _tmain
1.) when cursor is in it, bracket highlighting ends on # in line with #endif ( I mean, does not end on closing bracket )
2.) try to add include for std::string str; VAX adds it into _tmain body.
Seems like parsing error, code compiles...