The Go spec says that carriage returns in raw string literals should
be discarded.  The Go frontend was not doing that.  This is
http://golang.org/issue/10407.  This patch from Minux fixes it.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian
diff -r 2f1e891805e6 go/lex.cc
--- a/go/lex.cc Wed Apr 08 07:16:50 2015 -0700
+++ b/go/lex.cc Fri Apr 10 17:02:42 2015 -0700
@@ -1440,7 +1440,10 @@
          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())

Reply via email to