Commit c0d9bf56 authored by Daniel Morsing's avatar Daniel Morsing

cmd/gc: more robust checking of OIND nodes.

Fixes #4610.

R=golang-dev, remyoudompheng, rsc
CC=golang-dev, nigeltao
https://golang.org/cl/7058057
parent b6284700
...@@ -482,9 +482,12 @@ reswitch: ...@@ -482,9 +482,12 @@ reswitch:
n->left = N; n->left = N;
goto ret; goto ret;
} }
if((top & (Erv | Etop)) && !isptr[t->etype]) { if(!isptr[t->etype]) {
yyerror("invalid indirect of %lN", n->left); if(top & (Erv | Etop)) {
goto error; yyerror("invalid indirect of %lN", n->left);
goto error;
}
goto ret;
} }
ok |= Erv; ok |= Erv;
n->type = t->type; n->type = t->type;
......
// 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"
}
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