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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [interface/] [pointer.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
// Check that interface{M()} = *interface{M()} produces a compiler error.
8
 
9
package main
10
 
11
type Inst interface {
12
        Next() *Inst
13
}
14
 
15
type Regexp struct {
16
        code  []Inst
17
        start Inst
18
}
19
 
20
type Start struct {
21
        foo *Inst
22
}
23
 
24
func (start *Start) Next() *Inst { return nil }
25
 
26
 
27
func AddInst(Inst) *Inst {
28
        print("ok in addinst\n")
29
        return nil
30
}
31
 
32
func main() {
33
        print("call addinst\n")
34
        var x Inst = AddInst(new(Start)) // ERROR "pointer to interface"
35
        print("return from  addinst\n")
36
        var y *Inst = new(Start)  // ERROR "pointer to interface|incompatible type"
37
}

powered by: WebSVN 2.1.0

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