OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [chan/] [perm.go] - Blame information for rev 700

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 700 jeremybenn
// errchk $G -e $D/$F.go
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
 
7
package main
8
 
9
var (
10
        cr <-chan int
11
        cs chan<- int
12
        c  chan int
13
)
14
 
15
func main() {
16
        cr = c  // ok
17
        cs = c  // ok
18
        c = cr  // ERROR "illegal types|incompatible|cannot"
19
        c = cs  // ERROR "illegal types|incompatible|cannot"
20
        cr = cs // ERROR "illegal types|incompatible|cannot"
21
        cs = cr // ERROR "illegal types|incompatible|cannot"
22
 
23
        c <- 0 // ok
24
        <-c    // ok
25
        x, ok := <-c    // ok
26
        _, _ = x, ok
27
 
28
        cr <- 0 // ERROR "send"
29
        <-cr    // ok
30
        x, ok = <-cr    // ok
31
        _, _ = x, ok
32
 
33
        cs <- 0 // ok
34
        <-cs    // ERROR "receive"
35
        x, ok = <-cs    // ERROR "receive"
36
        _, _ = x, ok
37
 
38
        select {
39
        case c <- 0: // ok
40
        case x := <-c: // ok
41
                _ = x
42
 
43
        case cr <- 0: // ERROR "send"
44
        case x := <-cr: // ok
45
                _ = x
46
 
47
        case cs <- 0: // ok
48
        case x := <-cs: // ERROR "receive"
49
                _ = x
50
        }
51
 
52
        for _ = range cs {// ERROR "receive"
53
        }
54
 
55
        close(c)
56
        close(cs)
57
        close(cr)  // ERROR "receive"
58
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.