go/test/fixedbugs/issue15311.go
Ian Lance Taylor f5423a63df cmd/compile: a dot expression can not be a struct literal key
Passes toolstash -cmp.

Fixes #15311.

Change-Id: I1d67f5c9de38e899ab2d6c8986fabd6f197df23a
Reviewed-on: https://go-review.googlesource.com/22162
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-04-18 15:09:47 +00:00

21 lines
529 B
Go

// errorcheck
// Copyright 2016 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.
// The compiler was failing to correctly report an error when a dot
// expression was used a struct literal key.
package p
type T struct {
toInt map[string]int
toString map[int]string
}
var t = T{
foo.toInt: make(map[string]int), // ERROR "field name"
bar.toString: make(map[int]string), // ERROR "field name"
}