You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
internal compiler error: switch on interface{} causes invalid operation: autotmp_0000 <= (interface {})(2) (operator <= not defined on interface)
#2672
Closed
remyoudompheng opened this issue
Jan 9, 2012
· 5 comments
1. What is a short input program that triggers the error?
package pkg
func f(x interface{}) {
switch x {
case 1:
case 2:
case 3:
case 4:
}
}
2. What is the full compiler output?
test.go:7: invalid operation: autotmp_0000 <= (interface {})(2) (operator <= not
defined on interface)
3. What version of the compiler are you using? (Run it with the -V flag.)
6g version weekly.2011-12-22 11133+
The text was updated successfully, but these errors were encountered:
I do believe that the switch is spec-compliant. Removing one of the cases is OK. Adding
more cases displays some more error messages. I guess this is because the switch is
implemented as binary search, and I had to embarrassingly work around it using some ugly
type assertions.
I hope the fix is not too ugly.
The text was updated successfully, but these errors were encountered: