aboutsummaryrefslogtreecommitdiff
path: root/test/complit.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2008-10-21 16:53:54 -0700
committerRuss Cox <rsc@golang.org>2008-10-21 16:53:54 -0700
commitbeee6915f82633e5aed82297201a80920cc0c647 (patch)
treeeb5f5a6bb5a2bf8ccc4f042bd66ca2e06fdd80fa /test/complit.go
parent2c3ddf5ef6755e7a559128b6e55bf93aa6c78157 (diff)
downloadgo-beee6915f82633e5aed82297201a80920cc0c647.tar.gz
go-beee6915f82633e5aed82297201a80920cc0c647.zip
rewrite &Point{1, 2} as allocation
R=ken OCL=17592 CL=17592
Diffstat (limited to 'test/complit.go')
-rw-r--r--test/complit.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/complit.go b/test/complit.go
index d0ebfad97c..86985b994a 100644
--- a/test/complit.go
+++ b/test/complit.go
@@ -22,6 +22,11 @@ func eq(a *[]*R) {
}
}
+type P struct { a, b int };
+func NewP(a, b int) *P {
+ return &P{a, b}
+}
+
func main() {
var t T;
t = T{0, 7.2, "hi", &t};
@@ -57,4 +62,8 @@ func main() {
if len(m) != 3 { panic("m") }
eq(&[]*R{itor(0), itor(1), itor(2), itor(3), itor(4), itor(5)});
+
+ p1 := NewP(1, 2);
+ p2 := NewP(1, 2);
+ if p1 == p2 { panic("NewP") }
}