[AArch64] SVE tests
[official-gcc.git] / gcc / testsuite / go.test / test / method2.go
blobaaa850e7191c96171eaa173a44dd4033b7b43883
1 // errorcheck
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.
7 // Verify that pointers and interface types cannot be method receivers.
8 // Does not compile.
10 package main
12 type T struct {
13 a int
15 type P *T
16 type P1 *T
18 func (p P) val() int { return 1 } // ERROR "receiver.* pointer|invalid pointer or interface receiver"
19 func (p *P1) val() int { return 1 } // ERROR "receiver.* pointer|invalid pointer or interface receiver"
21 type I interface{}
22 type I1 interface{}
24 func (p I) val() int { return 1 } // ERROR "receiver.*interface|invalid pointer or interface receiver"
25 func (p *I1) val() int { return 1 } // ERROR "receiver.*interface|invalid pointer or interface receiver"
27 type Val interface {
28 val() int
31 var _ = (*Val).val // ERROR "method"
33 var v Val
34 var pv = &v
36 var _ = pv.val() // ERROR "method"
37 var _ = pv.val // ERROR "method"