aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Lex/TokenLexer.cpp2
-rw-r--r--test/Preprocessor/macro_paste_bad.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/Lex/TokenLexer.cpp b/lib/Lex/TokenLexer.cpp
index 5675f3f7c0..318c57cc5f 100644
--- a/lib/Lex/TokenLexer.cpp
+++ b/lib/Lex/TokenLexer.cpp
@@ -473,7 +473,7 @@ bool TokenLexer::PasteTokens(Token &Tok) {
// Do not emit the warning when preprocessing assembler code.
if (!PP.getLangOptions().AsmPreprocessor)
PP.Diag(PasteOpLoc, diag::err_pp_bad_paste)
- << std::string(Buffer.begin(), Buffer.end()-1);
+ << std::string(Buffer.begin(), Buffer.end());
// Do not consume the RHS.
--CurToken;
diff --git a/test/Preprocessor/macro_paste_bad.c b/test/Preprocessor/macro_paste_bad.c
index b43d70b0c4..c3b6179021 100644
--- a/test/Preprocessor/macro_paste_bad.c
+++ b/test/Preprocessor/macro_paste_bad.c
@@ -1,7 +1,9 @@
// RUN: clang-cc -Eonly -verify -pedantic %s
// pasting ""x"" and ""+"" does not give a valid preprocessing token
-#define XYZ x ## + // expected-error {{pasting formed 'x', an invalid preprocessing token}}
+#define XYZ x ## + // expected-error {{pasting formed 'x+', an invalid preprocessing token}}
XYZ
+#define XXYZ . ## test // expected-error {{pasting formed '.test', an invalid preprocessing token}}
+XXYZ
// GCC PR 20077