Fixed #1981 (false positive: syntax error on template operator <)

This commit is contained in:
Daniel Marjamäki 2010-08-26 07:43:00 +02:00
parent 5c3ecc31da
commit 8b18aaff25
2 changed files with 12 additions and 1 deletions

View File

@ -1785,7 +1785,9 @@ bool Tokenizer::tokenize(std::istream &code, const char FileName[], const std::s
else if (tok2->str() == "<") else if (tok2->str() == "<")
{ {
bool inclevel = false; bool inclevel = false;
if (level == 0) if (Token::simpleMatch(tok2->previous(), "operator <"))
;
else if (level == 0)
inclevel = true; inclevel = true;
else if (tok2->next()->isStandardType()) else if (tok2->next()->isStandardType())
inclevel = true; inclevel = true;

View File

@ -3682,6 +3682,15 @@ private:
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
// ok code..
{
errout.str("");
std::istringstream istr("template<class T> operator<(T a, T b) { }\n");
Tokenizer tokenizer(0, this);
tokenizer.tokenize(istr, "test.cpp");
ASSERT_EQUALS("", errout.str());
}
// bad code.. missing ">" // bad code.. missing ">"
{ {
errout.str(""); errout.str("");