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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 700 jeremybenn
// $G $D/$F.go && $L $F.$A && ./$A.out
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
 
8
package main
9
 
10
type C struct {
11
        a       int;
12
        x       func(p *C)int;
13
}
14
 
15
func (this *C) f()int {
16
        return this.a;
17
}
18
 
19
func
20
main() {
21
        var v int;
22
        var c *C;
23
 
24
        c = new(C);
25
        c.a = 6;
26
        c.x = g;
27
 
28
        v = g(c);
29
        if v != 6 { panic(v); }
30
 
31
        v = c.x(c);
32
        if v != 6 { panic(v); }
33
 
34
        v = c.f();
35
        if v != 6 { panic(v); }
36
}
37
 
38
func g(p *C)int {
39
        var v int;
40
 
41
        v = p.a;
42
        if v != 6 { panic(v); }
43
        return p.a;
44
}

powered by: WebSVN 2.1.0

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