]> Cypherpunks.ru repositories - gostls13.git/blob - test/ddd1.go
gc: ... T corner cases
[gostls13.git] / test / ddd1.go
1 // errchk $G -e $D/$F.go
2
3 // Copyright 2010 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
7 package main
8
9 func sum(args ...int) int { return 0 }
10
11 var (
12         _ = sum(1, 2, 3)
13         _ = sum()
14         _ = sum(1.0, 2.0)
15         _ = sum(1.5)      // ERROR "integer"
16         _ = sum("hello")  // ERROR "convert"
17         _ = sum([]int{1}) // ERROR "slice literal.*as type int"
18 )
19
20 type T []T
21
22 func funny(args ...T) int { return 0 }
23
24 var (
25         _ = funny(nil)
26         _ = funny(nil, nil)
27         _ = funny([]T{}) // ok because []T{} is a T; passes []T{[]T{}}
28 )