mirror of
https://github.com/golang/go
synced 2025-05-14 04:42:13 +00:00
cmd/gc: check for initialization cycles in method values
Fixes #7960. LGTM=rsc R=rsc CC=golang-codereviews, gri https://golang.org/cl/159800045
This commit is contained in:
src/cmd/gc
test/fixedbugs
issue6703a.goissue6703b.goissue6703c.goissue6703d.goissue6703e.goissue6703f.goissue6703g.goissue6703h.goissue6703i.goissue6703j.goissue6703k.goissue6703l.goissue6703m.goissue6703n.goissue6703o.goissue6703p.goissue6703q.goissue6703r.goissue6703s.goissue6703t.goissue6703u.goissue6703v.goissue6703w.goissue6703x.goissue6703y.goissue6703z.go
21
test/fixedbugs/issue6703x.go
Normal file
21
test/fixedbugs/issue6703x.go
Normal file
@ -0,0 +1,21 @@
|
||||
// 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.
|
||||
|
||||
// Check for cycles in a pointer value's method call.
|
||||
|
||||
package ptrmethcall
|
||||
|
||||
type T int
|
||||
|
||||
func (*T) pm() int {
|
||||
_ = x
|
||||
return 0
|
||||
}
|
||||
|
||||
var (
|
||||
p *T
|
||||
x = p.pm() // ERROR "initialization loop|depends upon itself"
|
||||
)
|
Reference in New Issue
Block a user