summaryrefslogtreecommitdiff
path: root/test/fixedbugs/issue7363.go
blob: 726396a7ceff207a345de8f25143ba111e4e4f52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// run

// Copyright 2014 The Go Authors.  All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// issue 7363: CanSet must return false for unexported embedded struct fields.

package main

import "reflect"

type a struct {
}

type B struct {
	a
}

func main() {
	b := &B{}
	v := reflect.ValueOf(b).Elem().Field(0)
	if v.CanSet() {
		panic("B.a is an unexported embedded struct field")
	}
}