Commit f2e94b58 authored by Daniel Morsing's avatar Daniel Morsing

cmd/gc: silence assignment errors to undefined symbols

Fixes #6406.

R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/46900043
parent 880442f1
......@@ -2680,6 +2680,11 @@ checkassign(Node *n)
n->etype = 1;
return;
}
// have already complained about n being undefined
if(n->op == ONONAME)
return;
yyerror("cannot assign to %N", n);
}
......
// errorcheck
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main() {
s = "bob" // ERROR "undefined.*s"
_ = s // ERROR "undefined.*s"
}
......@@ -14,5 +14,5 @@ func mine(int b) int { // ERROR "undefined.*b"
func main() {
mine() // GCCGO_ERROR "not enough arguments"
c = mine() // ERROR "undefined.*c|not enough arguments" "cannot assign to c"
c = mine() // ERROR "undefined.*c|not enough arguments"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment