Source file
test/ddd1.go
1
2
3
4
5
6
7
8
9
10 package main
11
12 import "unsafe"
13
14 func sum(args ...int) int { return 0 }
15
16 var (
17 _ = sum(1, 2, 3)
18 _ = sum()
19 _ = sum(1.0, 2.0)
20 _ = sum(1.5)
21 _ = sum("hello")
22 _ = sum([]int{1})
23 )
24
25 func sum3(int, int, int) int { return 0 }
26 func tuple() (int, int, int) { return 1, 2, 3 }
27
28 var (
29 _ = sum(tuple())
30 _ = sum(tuple()...)
31 _ = sum3(tuple())
32 _ = sum3(tuple()...)
33 )
34
35 type T []T
36
37 func funny(args ...T) int { return 0 }
38
39 var (
40 _ = funny(nil)
41 _ = funny(nil, nil)
42 _ = funny([]T{})
43 )
44
45 func Foo(n int) {}
46
47 func bad(args ...int) {
48 print(1, 2, args...)
49 println(args...)
50 ch := make(chan int)
51 close(ch...)
52 _ = len(args...)
53 _ = new(int...)
54 n := 10
55 _ = make([]byte, n...)
56 _ = make([]byte, 10 ...)
57 var x int
58 _ = unsafe.Pointer(&x...)
59 _ = unsafe.Sizeof(x...)
60 _ = [...]byte("foo")
61 _ = [...][...]int{{1,2,3},{4,5,6}}
62
63 Foo(x...)
64 }
65
View as plain text