Commit 032ffb2e authored by Russ Cox's avatar Russ Cox

gc: more graceful errors during struct definition

Fixes #2110.

R=ken2
CC=golang-dev
https://golang.org/cl/4823060
parent 33a4da89
......@@ -746,10 +746,8 @@ stotype(NodeList *l, int et, Type **t, int funarg)
} else {
typecheck(&n->right, Etype);
n->type = n->right->type;
if(n->type == T) {
*t0 = T;
return t0;
}
if(n->type == T)
continue;
if(left != N)
left->type = n->type;
n->right = N;
......
// errchk $G $D/$F.go
// Copyright 2011 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.
// check that compiler doesn't stop reading struct def
// after first unknown type.
// Fixes issue 2110.
package main
type S struct {
err os.Error // ERROR "undefined"
Num int
}
func main() {
s := S{}
_ = s.Num // no error here please
}
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