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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [fixedbugs/] [bug184.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 Buffer int
12
 
13
func (*Buffer) Read() {}
14
 
15
type Reader interface {
16
        Read()
17
}
18
 
19
func f() *Buffer { return nil }
20
 
21
func g() Reader {
22
        // implicit interface conversion in assignment during return
23
        return f()
24
}
25
 
26
func h() (b *Buffer, ok bool) { return }
27
 
28
func i() (r Reader, ok bool) {
29
        // implicit interface conversion in multi-assignment during return
30
        return h()
31
}
32
 
33
func fmter() (s string, i int, t string) { return "%#x %q", 100, "hello" }
34
 
35
func main() {
36
        b := g()
37
        bb, ok := b.(*Buffer)
38
        _, _, _ = b, bb, ok
39
 
40
        b, ok = i()
41
        bb, ok = b.(*Buffer)
42
        _, _, _ = b, bb, ok
43
 
44
        s := fmt.Sprintf(fmter())
45
        if s != "0x64 \"hello\"" {
46
                println(s)
47
                panic("fail")
48
        }
49
}

powered by: WebSVN 2.1.0

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