mirror of
https://github.com/golang/go
synced 2024-11-12 00:20:22 -07:00
cmd/gc: more robust checking of OIND nodes.
Fixes #4610. R=golang-dev, remyoudompheng, rsc CC=golang-dev, nigeltao https://golang.org/cl/7058057
This commit is contained in:
parent
b62847000b
commit
c0d9bf5650
@ -482,9 +482,12 @@ reswitch:
|
||||
n->left = N;
|
||||
goto ret;
|
||||
}
|
||||
if((top & (Erv | Etop)) && !isptr[t->etype]) {
|
||||
yyerror("invalid indirect of %lN", n->left);
|
||||
goto error;
|
||||
if(!isptr[t->etype]) {
|
||||
if(top & (Erv | Etop)) {
|
||||
yyerror("invalid indirect of %lN", n->left);
|
||||
goto error;
|
||||
}
|
||||
goto ret;
|
||||
}
|
||||
ok |= Erv;
|
||||
n->type = t->type;
|
||||
|
17
test/fixedbugs/issue4610.go
Normal file
17
test/fixedbugs/issue4610.go
Normal file
@ -0,0 +1,17 @@
|
||||
// errorcheck
|
||||
|
||||
// Copyright 2012 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
|
||||
|
||||
type bar struct {
|
||||
x int
|
||||
}
|
||||
|
||||
func main() {
|
||||
var foo bar
|
||||
_ = &foo{} // ERROR "is not a type"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user