Created
July 13, 2011 22:10
-
-
Save kylelemons/1081451 to your computer and use it in GitHub Desktop.
Possible compiler bug for a literal slice type in an if statement
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
$ 6g slice.go && sl -o slice slice.6 | |
slice.go:11: syntax error: unexpected }, expecting := or = or comma | |
$ 6g -V | |
6g version weekly.2011-07-07 9100+ |
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
package main | |
type Slice []int | |
func main() { | |
a := Slice{1,2} // ok | |
if got := a; true { // ok | |
} | |
got := Slice{1,2} // ok | |
if got := Slice{1,2}; true { // bad | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment