OSDN Git Service

Get rid of unsigned/long suffixes before evaluating numbers.
authorRoberto Raggi <roberto.raggi@nokia.com>
Thu, 29 Apr 2010 10:33:05 +0000 (12:33 +0200)
committerRoberto Raggi <roberto.raggi@nokia.com>
Thu, 29 Apr 2010 10:34:50 +0000 (12:34 +0200)
Task-number: QTCREATORBUG-1292

src/libs/cplusplus/pp-engine.cpp

index 6aa26b6..0282ac6 100644 (file)
@@ -253,14 +253,24 @@ protected:
     {
         if ((*_lex)->is(T_NUMERIC_LITERAL)) {
             int base = 10;
-            const QByteArray spell = tokenSpell();
+            QByteArray spell = tokenSpell();
             if (spell.at(0) == '0') {
                 if (spell.size() > 1 && (spell.at(1) == 'x' || spell.at(1) == 'X'))
                     base = 16;
                 else
                     base = 8;
             }
-            _value.set_long(tokenSpell().toLong(0, base));
+
+            while (! spell.isEmpty()) {
+                const QChar ch = spell.at(spell.length() - 1);
+
+                if (! (ch == QLatin1Char('u') || ch == QLatin1Char('U') ||
+                       ch == QLatin1Char('l') || ch == QLatin1Char('L')))
+                    break;
+                spell.chop(1);
+            }
+
+            _value.set_long(spell.toLong(0, base));
             ++(*_lex);
         } else if (isTokenDefined()) {
             ++(*_lex);