blob: d7fe8026e8d511994d64692cb5f6fa09f81ec404 [file] [log] [blame]
Daniel Morsinga45777f2012-10-07 06:53:57 +02001// run
2
Emmanuel Odeke53fd5222016-04-10 14:32:26 -07003// Copyright 2012 The Go Authors. All rights reserved.
Daniel Morsinga45777f2012-10-07 06:53:57 +02004// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7// part two of issue 4124. Make sure reflect doesn't mark the field as exported.
8
9package main
10
11import "reflect"
12
13var T struct {
14 int
15}
16
17func main() {
18 v := reflect.ValueOf(&T)
19 v = v.Elem().Field(0)
20 if v.CanSet() {
21 panic("int should be unexported")
22 }
23}