Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1404)

Side by Side Diff: test/fixedbugs/bug381.go

Issue 5445050: code review 5445050: gc: type-checking and initialization of recursive types. (Closed)
Patch Set: diff -r 9c49fd8294a5 https://go.googlecode.com/hg/ Created 12 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/cmd/gc/typecheck.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: should run
2
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.
6
7 package main
8
9 type List struct {
10 Item int
11 Next *List
12 }
13
14 type Foo struct{ *Bar }
15
16 type Bar struct{ *Foo }
17
18 var x = Foo{&y}
19 var y = Bar{&x}
20 var l = List{0, &l}
21
22 func main() {
23 if y.Foo != &x {
24 println("y was not initialized with &x!")
25 }
26 if x.Bar != &y {
27 println("x was not initialized with &y!")
28 }
29
30 if l.Next != &l {
31 println("l should have been initialized with its own address")
32 }
33 }
OLDNEW
« no previous file with comments | « src/cmd/gc/typecheck.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b