Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
Milestone

Comments

@remyoudompheng
Copy link
Contributor

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+
@remyoudompheng
Copy link
Contributor Author

Comment 1:

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.

@lvdlvd
Copy link

lvdlvd commented Jan 9, 2012

Comment 2:

Labels changed: added priority-go1, compilerbug, removed priority-triage.

Owner changed to @lvdlvd.

Status changed to Accepted.

@robpike
Copy link
Contributor

robpike commented Jan 13, 2012

Comment 3:

Owner changed to builder@golang.org.

@lvdlvd
Copy link

lvdlvd commented Jan 13, 2012

Comment 4:

Owner changed to @lvdlvd.

@lvdlvd
Copy link

lvdlvd commented Jan 14, 2012

Comment 5:

This issue was closed by revision 6b72b07.

Status changed to Fixed.

@rsc rsc added this to the Go1 milestone Apr 10, 2015
@rsc rsc removed the priority-go1 label Apr 10, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants