From 2bfdbb87b7ecfee17447d9da5e9623a2beb140d3 Mon Sep 17 00:00:00 2001 From: peter klausler Date: Tue, 20 Feb 2018 10:35:04 -0800 Subject: [PATCH] [flang] Fix bug with "expected ..." messages in token strings. Original-commit: flang-compiler/f18@9cc84ba6fbbaed94481ec7781e124a7f4881a7b2 Reviewed-on: https://github.com/flang-compiler/f18/pull/14 Tree-same-pre-rewrite: false --- flang/lib/parser/message.h | 4 ++++ flang/lib/parser/token-parsers.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/flang/lib/parser/message.h b/flang/lib/parser/message.h index f4f9830..abefb60 100644 --- a/flang/lib/parser/message.h +++ b/flang/lib/parser/message.h @@ -69,6 +69,10 @@ public: extra_ += s; return *this; } + Message &operator+=(char ch) { + extra_ += ch; + return *this; + } Provenance Emit( std::ostream &, const AllSources &, bool echoSourceLine = true) const; diff --git a/flang/lib/parser/token-parsers.h b/flang/lib/parser/token-parsers.h index 07edf1f..4b8ea9f 100644 --- a/flang/lib/parser/token-parsers.h +++ b/flang/lib/parser/token-parsers.h @@ -133,7 +133,7 @@ public: } else if (*ch == tolower(*p)) { ch.reset(); } else { - state->PutMessage(at, "expected '"_en_US) += str_ + '\''; + (state->PutMessage(at, "expected '"_en_US) += str_) += '\''; return {}; } } -- 2.7.4