compiler: discard carriage returns in raw string literals

Fixes golang/go#10407.

From-SVN: r222001
This commit is contained in:
Ian Lance Taylor 2015-04-11 00:50:26 +00:00
parent b025e2920e
commit 055da6a8df
1 changed files with 4 additions and 1 deletions

View File

@ -1440,7 +1440,10 @@ Lex::gather_raw_string()
bool issued_error;
this->lineoff_ = p - this->linebuf_;
p = this->advance_one_utf8_char(p, &c, &issued_error);
Lex::append_char(c, true, &value, loc);
// "Carriage return characters ('\r') inside raw string literals
// are discarded from the raw string value."
if (c != '\r')
Lex::append_char(c, true, &value, loc);
}
this->lineoff_ = p - this->linebuf_;
if (!this->require_line())