summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Lex/Lexer.cpp1
-rw-r--r--clang/test/Lexer/cxx1y_digit_separators.cpp2
2 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index cfa835d173d..2adc51e109d 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/lib/Lex/Lexer.cpp
@@ -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);
}
}
diff --git a/clang/test/Lexer/cxx1y_digit_separators.cpp b/clang/test/Lexer/cxx1y_digit_separators.cpp
index 39ea3e7b8d7..df0c2624616 100644
--- a/clang/test/Lexer/cxx1y_digit_separators.cpp
+++ b/clang/test/Lexer/cxx1y_digit_separators.cpp
@@ -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}}
}
OpenPOWER on IntegriCloud