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

cmd/cgo: unexpected semicolon, expecting expression error (part III) #31017

Open
gooid opened this Issue Mar 24, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@gooid
Copy link

gooid commented Mar 24, 2019

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

$ go version
go version go1.12 windows/amd64

main.go

package main

import (
	"unsafe"
)

/*
void cgofoo(void* a, int b) {}
*/
import "C"

func foo() {
	var p unsafe.Pointer

	C.cgofoo(nil, (C.int)(
		0))

	C.cgofoo(p, (C.int)(0))

	// syntax error: unexpected semicolon, expecting expression
	C.cgofoo(p, (C.int)(
		0))
}

func main() {}

What did you expect to see?

build success,
but go 1.11.4 is ok.

What did you see instead?

main.go:21:27: syntax error: unexpected semicolon, expecting expression

@ALTree

This comment has been minimized.

Copy link
Member

ALTree commented Mar 24, 2019

Thanks for reporting this.

This is related to #29748 and #29781. I've verified that tip still fails, so it's probably another variation the previous fixes don't cover.

cc @ianlancetaylor

@ALTree ALTree added this to the Go1.13 milestone Mar 24, 2019

@ALTree ALTree added the NeedsFix label Mar 24, 2019

@ALTree ALTree changed the title cmd/go: build not compatibility cmd/cgo: unexpected semicolon, expecting expression error (part III) Mar 24, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.