OSDN Git Service

compiler: Better error for missing comma in composite literal.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 27 Sep 2012 05:41:46 +0000 (05:41 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 27 Sep 2012 05:41:46 +0000 (05:41 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@191796 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/go/gofrontend/parse.cc

index cfcc00f..f6b9715 100644 (file)
@@ -2723,7 +2723,11 @@ Parse::composite_lit(Type* type, int depth, Location location)
        }
       else
        {
-         error_at(this->location(), "expected %<,%> or %<}%>");
+         if (token->is_op(OPERATOR_SEMICOLON))
+           error_at(this->location(),
+                    "need trailing comma before newline in composite literal");
+         else
+           error_at(this->location(), "expected %<,%> or %<}%>");
 
          this->gogo_->mark_locals_used();
          int depth = 0;