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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [const3.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
package main
8
 
9
import "fmt"
10
 
11
type T int
12
 
13
func (t T) String() string { return fmt.Sprintf("T%d", int(t)) }
14
 
15
const (
16
        A T = 1 << (1 << iota)
17
        B
18
        C
19
        D
20
        E
21
)
22
 
23
func main() {
24
        s := fmt.Sprintf("%v %v %v %v %v", A, B, C, D, E)
25
        if s != "T2 T4 T16 T256 T65536" {
26
                println("type info didn't propagate in const: got", s)
27
                panic("fail")
28
        }
29
        x := uint(5)
30
        y := float64(uint64(1)<
31
        if y != 32 {
32
                println("wrong y", y)
33
                panic("fail")
34
        }
35
}

powered by: WebSVN 2.1.0

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