Skip to content

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

@gooid

Description

@gooid

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions