2008-10-08 10:21:57 -06:00
|
|
|
// errchk $G $D/$F.go
|
|
|
|
|
|
|
|
// Copyright 2009 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.
|
|
|
|
|
2009-05-12 17:09:47 -06:00
|
|
|
// Check that interface{M()} = *interface{M()} produces a compiler error.
|
|
|
|
|
2008-10-08 10:21:57 -06:00
|
|
|
package main
|
|
|
|
|
2009-01-20 15:40:40 -07:00
|
|
|
type Inst interface {
|
2010-06-08 19:50:02 -06:00
|
|
|
Next() *Inst
|
2008-10-08 10:21:57 -06:00
|
|
|
}
|
|
|
|
|
2009-01-20 15:40:40 -07:00
|
|
|
type Regexp struct {
|
2010-06-08 19:50:02 -06:00
|
|
|
code []Inst
|
|
|
|
start Inst
|
2008-10-08 10:21:57 -06:00
|
|
|
}
|
|
|
|
|
2009-01-20 15:40:40 -07:00
|
|
|
type Start struct {
|
2010-06-08 19:50:02 -06:00
|
|
|
foo *Inst
|
2008-10-08 10:21:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (start *Start) Next() *Inst { return nil }
|
|
|
|
|
|
|
|
|
2009-01-20 15:40:40 -07:00
|
|
|
func AddInst(Inst) *Inst {
|
2010-06-08 19:50:02 -06:00
|
|
|
print("ok in addinst\n")
|
2008-10-08 10:21:57 -06:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
2010-06-08 19:50:02 -06:00
|
|
|
print("call addinst\n")
|
|
|
|
var x Inst = AddInst(new(Start)) // ERROR "pointer to interface"
|
|
|
|
print("return from addinst\n")
|
2011-04-21 06:20:29 -06:00
|
|
|
var x *Inst = new(Start) // ERROR "pointer to interface"
|
2008-10-08 10:21:57 -06:00
|
|
|
}
|