Hello group,

Why are the following snippets errors?

https://play.golang.org/p/mgEYMNNw9h
type S struct {
 i int
}

 if S{i: 0} == S{} {
 }
syntax error: unexpected == at end of statement

 switch S{i: 0} == S{} {
 }
syntax error: unexpected i, expecting case or default or }

It works without error if you surround each literal with ( ), or the entire 
comparison expression with ( ).
The following also works without error:
 _ = S{i: 0} == S{}

Does the language spec state those are errors, or is this a bug in the 
parser?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to