Commit 35f33e38 by Ian Lance Taylor

runtime: Delete from a nil map is now a no-op.

From-SVN: r194462
parent 8318d4ce
...@@ -151,9 +151,8 @@ func maptest() { ...@@ -151,9 +151,8 @@ func maptest() {
shouldPanic(func() { shouldPanic(func() {
m[2] = 3 m[2] = 3
}) })
shouldPanic(func() { // can delete (non-existent) entries
delete(m, 2) delete(m, 2)
})
} }
// nil slice // nil slice
......
...@@ -27,7 +27,7 @@ __go_map_delete (struct __go_map *map, const void *key) ...@@ -27,7 +27,7 @@ __go_map_delete (struct __go_map *map, const void *key)
void **pentry; void **pentry;
if (map == NULL) if (map == NULL)
runtime_panicstring ("deletion of entry in nil map"); return;
descriptor = map->__descriptor; descriptor = map->__descriptor;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment