diff options
Diffstat (limited to 'gcc/testsuite/go.test/test/ddd.go')
-rw-r--r-- | gcc/testsuite/go.test/test/ddd.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/gcc/testsuite/go.test/test/ddd.go b/gcc/testsuite/go.test/test/ddd.go index b95d6e883..01768b89f 100644 --- a/gcc/testsuite/go.test/test/ddd.go +++ b/gcc/testsuite/go.test/test/ddd.go @@ -1,9 +1,11 @@ -// $G $D/$F.go && $L $F.$A && ./$A.out +// run // Copyright 2010 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. +// Test variadic functions and calls (dot-dot-dot). + package main func sum(args ...int) int { @@ -58,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) @@ -205,7 +211,14 @@ func main() { println("i(=u).Sum", x) panic("fail") } - /* TODO(rsc): Enable once nested method expressions work. + var s struct { + I + } + s.I = &u + if x := s.Sum(2, 3, 5, 8); x != 18 { + println("s{&u}.Sum", x) + panic("fail") + } if x := (*U).Sum(&U{}, 1, 3, 5, 2); x != 11 { println("(*U).Sum", x) panic("fail") @@ -214,5 +227,4 @@ func main() { println("U.Sum", x) panic("fail") } - */ } |