This repository has been archived by the owner on Jun 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/compile: a dot expression can not be a struct literal key
Passes toolstash -cmp. Fixes golang#15311. Change-Id: I1d67f5c9de38e899ab2d6c8986fabd6f197df23a Reviewed-on: https://go-review.googlesource.com/22162 Reviewed-by: David Crawshaw <[email protected]>
- Loading branch information
1 parent
95df0c6
commit f5423a6
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// 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" | ||
} |