From 008d8c0ad1d6f5d346093dcb96d939fc5afe6052 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Fri, 28 Feb 2014 20:06:02 +0000 Subject: [PATCH] Fix a minor bug in lexing pp-numbers with digit separators: if a pp-number contains "'e+", the pp-number ends between the 'e' and the '+'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202533 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Lex/Lexer.cpp | 1 + test/Lexer/cxx1y_digit_separators.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index cfa835d173..2adc51e109 100644 --- a/lib/Lex/Lexer.cpp +++ b/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/test/Lexer/cxx1y_digit_separators.cpp b/test/Lexer/cxx1y_digit_separators.cpp index 39ea3e7b8d..df0c262461 100644 --- a/test/Lexer/cxx1y_digit_separators.cpp +++ b/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}} } -- 2.40.0