Commit 28a50c7f authored by Shenghou Ma's avatar Shenghou Ma

runtime: deletion on nil maps is a no-op now

Fixes #4535.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6942044
parent e470b335
...@@ -989,7 +989,7 @@ runtime·mapdelete(MapType *t, Hmap *h, ...) ...@@ -989,7 +989,7 @@ runtime·mapdelete(MapType *t, Hmap *h, ...)
byte *ak; byte *ak;
if(h == nil) if(h == nil)
runtime·panicstring("deletion of entry in nil map"); return;
if(raceenabled) if(raceenabled)
runtime·racewritepc(h, runtime·getcallerpc(&t), runtime·mapdelete); runtime·racewritepc(h, runtime·getcallerpc(&t), runtime·mapdelete);
......
// run
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main() {
var m map[int]int
delete(m, 0)
}
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