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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 700 jeremybenn
// $G $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
// Correct short declarations and redeclarations.
8
 
9
package main
10
 
11
func f1() int                    { return 1 }
12
func f2() (float32, int)         { return 1, 2 }
13
func f3() (float32, int, string) { return 1, 2, "3" }
14
 
15
func x() (s string) {
16
        a, b, s := f3()
17
        _, _ = a, b
18
        return // tests that result var is in scope for redeclaration
19
}
20
 
21
func main() {
22
        i, f, s := f3()
23
        j, f := f2() // redeclare f
24
        k := f1()
25
        m, g, s := f3()
26
        m, h, s := f3()
27
        {
28
                // new block should be ok.
29
                i, f, s := f3()
30
                j, f := f2() // redeclare f
31
                k := f1()
32
                m, g, s := f3()
33
                m, h, s := f3()
34
                _, _, _, _, _, _, _, _, _ = i, f, s, j, k, m, g, s, h
35
        }
36
        if x() != "3" {
37
                println("x() failed")
38
        }
39
        _, _, _, _, _, _, _, _, _ = i, f, s, j, k, m, g, s, h
40
}

powered by: WebSVN 2.1.0

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