File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -356,6 +356,8 @@ MathLib::bigint MathLib::characterLiteralToLongNumber(const std::string& str)
356356 // is implementation-defined.
357357 // clang and gcc seem to use the following encoding: 'AB' as (('A' << 8) | 'B')
358358 const std::string& normStr = normalizeCharacterLiteral (str);
359+ if (normStr.empty ())
360+ throw InternalError (0 , " Internal Error. MathLib::characterLiteralToLongNumber: Unhandled char constant '" + str + " '." );
359361 return encodeMultiChar (normStr);
360362}
361363
Original file line number Diff line number Diff line change @@ -301,6 +301,7 @@ class TestMathLib : public TestFixture {
301301 ASSERT_EQUALS (0 , MathLib::characterLiteralToLongNumber (std::string (" " )));
302302 ASSERT_EQUALS (32 , MathLib::characterLiteralToLongNumber (std::string (" " )));
303303 ASSERT_EQUALS (538976288 , MathLib::characterLiteralToLongNumber (std::string (" " )));
304+ ASSERT_THROW (MathLib::characterLiteralToLongNumber (std::string (" \\ u" )), InternalError);
304305 }
305306
306307 ASSERT_EQUALS (-8552249625308161526 , MathLib::toLongNumber (" 0x89504e470d0a1a0a" ));
You can’t perform that action at this time.
0 commit comments