diff options
author | Ian Lance Taylor <iant@golang.org> | 2012-03-07 08:24:10 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2012-03-07 08:24:10 -0800 |
commit | 5fd14b800bc646ff79eeceaf73b5ab5463f0f5e9 (patch) | |
tree | 219580bd73c9a48d13db3cfa60c8f8a5452b5847 /test/ddd.go | |
parent | 0e29b6c466e313f2242e6f8a6123d5b08433091a (diff) | |
download | go-5fd14b800bc646ff79eeceaf73b5ab5463f0f5e9.tar.gz |
test: add inherited interface test to ddd.go
The gccgo compiler incorrectly gave an error for this code.
R=golang-dev, rsc
CC=golang-dev
http://codereview.appspot.com/5767043
Diffstat (limited to 'test/ddd.go')
-rw-r--r-- | test/ddd.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ddd.go b/test/ddd.go index f35836331..3b595b5f8 100644 --- a/test/ddd.go +++ b/test/ddd.go @@ -60,6 +60,10 @@ type U struct { *T } +type I interface { + Sum(...int) int +} + func main() { if x := sum(1, 2, 3); x != 6 { println("sum 6", x) @@ -207,6 +211,14 @@ func main() { println("i(=u).Sum", x) panic("fail") } + var s struct { + I + } + s.I = &u + if x := s.Sum(2, 3, 5, 8); x != 18 { + println("s{&u}.Sum", x) + panic("fail") + } /* TODO(rsc): Enable once nested method expressions work. if x := (*U).Sum(&U{}, 1, 3, 5, 2); x != 11 { println("(*U).Sum", x) |