Ticket #7565: Handle numbers with several C++14 integer separators.

This commit is contained in:
Simon Martin 2016-07-01 23:22:16 +02:00
parent e795eef465
commit 40eacb19b1
2 changed files with 4 additions and 1 deletions

View File

@ -1280,6 +1280,8 @@ bool MathLib::isDigitSeparator(const std::string& iCode, std::string::size_type
case '~':
case '=':
return true;
case '\'':
return isDigitSeparator(iCode, i);
default:
return false;
}

View File

@ -1145,7 +1145,7 @@ private:
ASSERT_THROW(MathLib::normalizeCharacterLiteral("\\c"), InternalError);
}
void CPP14DigitSeparators() { // Ticket #7137
void CPP14DigitSeparators() { // Ticket #7137, #7565
ASSERT(MathLib::isDigitSeparator("'", 0) == false);
ASSERT(MathLib::isDigitSeparator("123'0;", 3));
ASSERT(MathLib::isDigitSeparator("foo(1'2);", 5));
@ -1160,6 +1160,7 @@ private:
ASSERT(MathLib::isDigitSeparator("if (120|1'2) { char c = 'c'; }", 9));
ASSERT(MathLib::isDigitSeparator("if (120%1'2) { char c = 'c'; }", 24) == false);
ASSERT(MathLib::isDigitSeparator("if (120%1'2) { char c = 'c'; }", 26) == false);
ASSERT(MathLib::isDigitSeparator("0b0000001'0010'01110", 14));
}
};