mirror of https://github.com/golang/go.git
runtime: deletion on nil maps is a no-op now
Fixes #4535. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6942044
This commit is contained in:
parent
e470b3354c
commit
28a50c7f51
|
|
@ -989,7 +989,7 @@ runtime·mapdelete(MapType *t, Hmap *h, ...)
|
|||
byte *ak;
|
||||
|
||||
if(h == nil)
|
||||
runtime·panicstring("deletion of entry in nil map");
|
||||
return;
|
||||
|
||||
if(raceenabled)
|
||||
runtime·racewritepc(h, runtime·getcallerpc(&t), runtime·mapdelete);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
// 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)
|
||||
}
|
||||
Loading…
Reference in New Issue