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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 700 jeremybenn
// errchk $G $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
// Error messages about missing implicit methods.
8
 
9
package main
10
 
11
type T int
12
 
13
func (t T) V()
14
func (t *T) P()
15
 
16
type V interface {
17
        V()
18
}
19
type P interface {
20
        P()
21
        V()
22
}
23
 
24
type S struct {
25
        T
26
}
27
type SP struct {
28
        *T
29
}
30
 
31
func main() {
32
        var t T
33
        var v V
34
        var p P
35
        var s S
36
        var sp SP
37
 
38
        v = t
39
        p = t // ERROR "does not implement|requires a pointer"
40
        _, _ = v, p
41
        v = &t
42
        p = &t
43
        _, _ = v, p
44
 
45
        v = s
46
        p = s // ERROR "does not implement|requires a pointer"
47
        _, _ = v, p
48
        v = &s
49
        p = &s
50
        _, _ = v, p
51
 
52
        v = sp
53
        p = sp // no error!
54
        _, _ = v, p
55
        v = &sp
56
        p = &sp
57
        _, _ = v, p
58
}

powered by: WebSVN 2.1.0

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