aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Lex/LiteralSupport.cpp2
-rw-r--r--test/Lexer/numeric-literal-trash.c13
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp
index f9fd1aac79..8c2f2aff47 100644
--- a/lib/Lex/LiteralSupport.cpp
+++ b/lib/Lex/LiteralSupport.cpp
@@ -224,7 +224,7 @@ NumericLiteralParser(const char *begin, const char *end,
saw_period = true;
s = SkipDigits(s);
}
- if (*s == 'e' || *s == 'E') { // exponent
+ if (s != ThisTokEnd && (*s == 'e' || *s == 'E')) { // exponent
const char *Exponent = s;
s++;
saw_exponent = true;
diff --git a/test/Lexer/numeric-literal-trash.c b/test/Lexer/numeric-literal-trash.c
new file mode 100644
index 0000000000..243825a536
--- /dev/null
+++ b/test/Lexer/numeric-literal-trash.c
@@ -0,0 +1,13 @@
+/* RUN: clang -fsyntax-only -verify %s
+ */
+# define XRECORD(x, c_name) e##c (x, __LINE__)
+
+
+
+
+
+
+ void x() {
+
+XRECORD (XRECORD (1, 1), 1);
+ }