OSDN Git Service

Update Go testsuite to release r60.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / go.test / test / interface / private.go
1 // $G $D/${F}1.go && errchk $G $D/$F.go
2
3 // Copyright 2011 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 "./private1"
10
11 type Exported interface {
12         private()
13 }
14
15 type Implementation struct{}
16
17 func (p *Implementation) private() {}
18
19 func main() {
20         var x Exported
21         x = new(Implementation)
22         x.private()
23
24         var px p.Exported
25         px = p.X
26
27         px.private()                    // ERROR "private"
28
29         px = new(Implementation)        // ERROR "private"
30
31         x = px                          // ERROR "private"
32 }