Rémy Oudompheng | 2ece2f5 | 2012-02-18 22:15:42 +0100 | [diff] [blame] | 1 | // run |
Ian Lance Taylor | 4b4c6ab | 2010-02-08 15:40:09 -0800 | [diff] [blame] | 2 | |
Emmanuel Odeke | 53fd522 | 2016-04-10 14:32:26 -0700 | [diff] [blame] | 3 | // Copyright 2010 The Go Authors. All rights reserved. |
Ian Lance Taylor | 4b4c6ab | 2010-02-08 15:40:09 -0800 | [diff] [blame] | 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 | type S1 struct { |
| 10 | i int |
| 11 | } |
| 12 | type S2 struct { |
| 13 | i int |
| 14 | } |
| 15 | type S3 struct { |
| 16 | S1 |
| 17 | S2 |
| 18 | } |
| 19 | type S4 struct { |
| 20 | S3 |
| 21 | S1 |
| 22 | } |
Russ Cox | 00f9f0c | 2010-03-30 10:34:57 -0700 | [diff] [blame] | 23 | |
Ian Lance Taylor | 4b4c6ab | 2010-02-08 15:40:09 -0800 | [diff] [blame] | 24 | func main() { |
| 25 | var s4 S4 |
Russ Cox | 00f9f0c | 2010-03-30 10:34:57 -0700 | [diff] [blame] | 26 | if s4.i != 0 { // .i refers to s4.S1.i, unambiguously |
| 27 | panic("fail") |
Ian Lance Taylor | 4b4c6ab | 2010-02-08 15:40:09 -0800 | [diff] [blame] | 28 | } |
| 29 | } |