aboutsummaryrefslogtreecommitdiff
path: root/test/nilptr
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2010-08-31 07:34:01 -0700
committerIan Lance Taylor <iant@golang.org>2010-08-31 07:34:01 -0700
commit5309fae1a344b8a0d4e73a8505bc47e290496ee7 (patch)
treebf2b2e637f5c4a8394b0fed5dc82e773b4766a5f /test/nilptr
parent0f61f0140d4380df86a135d5d8ea89edff9fb278 (diff)
downloadgo-5309fae1a344b8a0d4e73a8505bc47e290496ee7.tar.xz
test: don't assign address of array to slice.
R=rsc CC=golang-dev https://golang.org/cl/2084042
Diffstat (limited to 'test/nilptr')
-rw-r--r--test/nilptr/arraytoslice.go2
-rw-r--r--test/nilptr/arraytoslice1.go2
-rw-r--r--test/nilptr/arraytoslice2.go2
3 files changed, 3 insertions, 3 deletions
diff --git a/test/nilptr/arraytoslice.go b/test/nilptr/arraytoslice.go
index 65b2f8a765..06c862d0d9 100644
--- a/test/nilptr/arraytoslice.go
+++ b/test/nilptr/arraytoslice.go
@@ -33,5 +33,5 @@ func main() {
// usual len and cap, we require the *array -> slice
// conversion to do the check.
var p *[1<<30]byte = nil;
- f(p); // should crash
+ f(p[0:]); // should crash
}
diff --git a/test/nilptr/arraytoslice1.go b/test/nilptr/arraytoslice1.go
index b5240a803a..286572a4d2 100644
--- a/test/nilptr/arraytoslice1.go
+++ b/test/nilptr/arraytoslice1.go
@@ -29,6 +29,6 @@ func main() {
// usual len and cap, we require the *array -> slice
// conversion to do the check.
var p *[1<<30]byte = nil;
- var x []byte = p; // should crash
+ var x []byte = p[0:]; // should crash
_ = x;
}
diff --git a/test/nilptr/arraytoslice2.go b/test/nilptr/arraytoslice2.go
index 38e1a5cb28..4ac97f13e8 100644
--- a/test/nilptr/arraytoslice2.go
+++ b/test/nilptr/arraytoslice2.go
@@ -31,5 +31,5 @@ func main() {
// conversion to do the check.
var x []byte;
var y = &x;
- *y = q; // should crash (uses arraytoslice runtime routine)
+ *y = q[0:]; // should crash (uses arraytoslice runtime routine)
}