blob: 07bd865c897922b0ad6850dc6388c23d4fcb337d [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() {
16 var s *S;
17 var i I;
Russ Coxe5124812009-01-08 18:06:06 -080018 var e interface {};
19 e = s;
Russ Cox49e20872009-02-11 17:55:16 -080020 i = e.(I);
Russ Cox1a319892009-09-14 21:03:53 -070021 _ = 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}