#7187 internal error; unhandled char constant \e. Support \e char literal support by clang,gcc,tcc

This commit is contained in:
Alexander Mai 2015-12-05 18:53:03 +01:00
parent 86c9387987
commit 5ddc5c0798
2 changed files with 4 additions and 0 deletions

View File

@ -375,6 +375,9 @@ MathLib::bigint MathLib::characterLiteralToLongNumber(const std::string& str)
case 'b':
c = '\b';
break;
case 'e':
c = 0x1B; // clang, gcc, tcc interpret this as 0x1B - escape character
break;
case 'f':
c = '\f';
break;

View File

@ -280,6 +280,7 @@ private:
// END Implementation-specific results
#endif
ASSERT_EQUALS((int)('\0'), MathLib::toLongNumber("'\\0'"));
ASSERT_EQUALS(0x1B, MathLib::toLongNumber("'\\e'"));
ASSERT_EQUALS((int)('\r'), MathLib::toLongNumber("'\\r'"));
ASSERT_EQUALS((int)('\x12'), MathLib::toLongNumber("'\\x12'"));
// may cause some compile problems: ASSERT_EQUALS((int)('\x123'), MathLib::toLongNumber("'\\x123'"));