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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [interface/] [fail.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
// Check that interface conversion fails when method is missing.
8
 
9
package main
10
 
11
type I interface {
12
        Foo()
13
}
14
 
15
func main() {
16
        shouldPanic(p1)
17
}
18
 
19
func p1() {
20
        var s *S
21
        var i I
22
        var e interface {}
23
        e = s
24
        i = e.(I)
25
        _ = i
26
}
27
 
28
type S struct {
29
}
30
 
31
func shouldPanic(f func()) {
32
        defer func() {
33
                if recover() == nil {
34
                        panic("function should panic")
35
                }
36
        }()
37
        f()
38
}

powered by: WebSVN 2.1.0

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