]> granicus.if.org Git - clang/commitdiff
Fix a minor bug in lexing pp-numbers with digit separators: if a pp-number contains...
authorRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 28 Feb 2014 20:06:02 +0000 (20:06 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 28 Feb 2014 20:06:02 +0000 (20:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202533 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/Lexer.cpp
test/Lexer/cxx1y_digit_separators.cpp

index cfa835d173d6aa503ae3a835f7cec717922a0f47..2adc51e109d72ed47d38cdb1e6c04720ebca5e21 100644 (file)
@@ -1620,6 +1620,7 @@ bool Lexer::LexNumericConstant(Token &Result, const char *CurPtr) {
       if (!isLexingRawMode())
         Diag(CurPtr, diag::warn_cxx11_compat_digit_separator);
       CurPtr = ConsumeChar(CurPtr, Size, Result);
+      CurPtr = ConsumeChar(CurPtr, NextSize, Result);
       return LexNumericConstant(Result, CurPtr);
     }
   }
index 39ea3e7b8d74659a59b249aba6334e24400b24d8..df0c26246161257411b5f7c64f9631defa1b531f 100644 (file)
@@ -18,6 +18,8 @@ namespace integral {
   int e = 0'b1010; // expected-error {{digit 'b' in octal constant}}
   int f = 0b'1010; // expected-error {{invalid digit 'b' in octal}}
   int g = 123'ms; // expected-error {{digit separator cannot appear at end of digit sequence}}
+  int h = 0x1e+1; // expected-error {{invalid suffix '+1' on integer constant}}
+  int i = 0x1'e+1; // ok, 'e+' is not recognized after a digit separator
 
   int z = 0'123'_foo; //'; // expected-error {{cannot appear at end of digit seq}}
 }