blob: 3e741d3f91ab93f63bb7c7075c352c0df85ed99c [file] [log] [blame]
Russ Coxb4f8e012008-10-08 09:21:57 -07001// $G $D/$F.go && $L $F.$A && ! ./$A.out
2
3// Copyright 2009 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
Russ Coxc7d30bc2009-05-12 16:09:47 -07007// Check that interface conversion fails when method is missing.
8
Russ Coxb4f8e012008-10-08 09:21:57 -07009package main
10
Russ Cox839a6842009-01-20 14:40:40 -080011type I interface {
Russ Coxb4f8e012008-10-08 09:21:57 -070012 Foo()
13}
14
15func main() {
Rob Pike4f61fc92010-09-04 10:36:13 +100016 var s *S
17 var i I
18 var e interface {}
19 e = s
20 i = e.(I)
21 _ = i
Russ Coxb4f8e012008-10-08 09:21:57 -070022}
23
24// hide S down here to avoid static warning
Russ Cox839a6842009-01-20 14:40:40 -080025type S struct {
Russ Coxb4f8e012008-10-08 09:21:57 -070026}