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

playground: vet and compile disagree on size of int #29825

Closed
vcabbage opened this issue Jan 18, 2019 · 4 comments
Closed

playground: vet and compile disagree on size of int #29825

vcabbage opened this issue Jan 18, 2019 · 4 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@vcabbage
Copy link
Member

What version of Go are you using (go version)?

I can only reproduce in the Go Playground

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

What did you do?

package main

import (
	"unsafe"
)

type myStruct struct {
	a, b int
}

var _ [8]byte = [unsafe.Sizeof(myStruct{})]byte{}

func main() {}

https://play.golang.org/p/asSsu2foRHF

What did you expect to see?

Successful compile.

What did you see instead?

prog.go:11:5: cannot use [16]byte literal (type [16]byte) as type [8]byte in assignment

Attempting to change the declaration to [16]byte results in:

prog.go:11:5: cannot use [8]byte literal (type [8]byte) as type [16]byte in assignment

This doesn't reproduce when compiling for amd64 or 386, so I expect it's specific to nacl.

@josharian josharian added the NeedsFix The path to resolution is known, but the work has not been done. label Jan 19, 2019
@josharian josharian added this to the Go1.13 milestone Jan 19, 2019
@ianlancetaylor
Copy link
Contributor

This is a playground specific problem. One error is coming from vet. One is coming from the compiler. The problem is that vet and the compiler when run on the playground don't agree on the size of int. You can see this more clearly if you change the main function to actually print something. In the case with the vet error, you will see the error, and you will also see the output.

@ianlancetaylor ianlancetaylor changed the title cmd/compile: incorrect type error in playground playground: vet and compile disagree on size of int Jan 19, 2019
@vcabbage
Copy link
Member Author

I completely missed that the message was from vet. Thanks!

@agnivade
Copy link
Contributor

/cc @ysmolsky

@bcmills
Copy link
Contributor

bcmills commented Jan 22, 2019

Duplicate of #27885.

@bcmills bcmills closed this as completed Jan 22, 2019
@golang golang locked and limited conversation to collaborators Jan 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants