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: some cgo messages mention C.unsignedchar but that is not a valid type #13635

Closed
bits01 opened this issue Dec 16, 2015 · 4 comments
Closed

Comments

@bits01
Copy link

bits01 commented Dec 16, 2015

When using C.uchar in code and getting some compilation errors, the error message mentions C.unsignedchar but that doesn't seem the be a valid type.

package main

import "C"

import "fmt"

func main() {
    var c C.uchar = "5"
    //var c C.unsignedchar = 5

    fmt.Println(c)
}


% go run main.go
# command-line-arguments
./main.go:8: cannot use "5" (type string) as type C.unsignedchar in assignment
@mattn
Copy link
Member

mattn commented Dec 16, 2015

"5" is string literal not character literal. it should be:

package main

import "C"

import "fmt"

func main() {
    var c C.uchar = '5'
    //var c C.unsignedchar = 5

    fmt.Println(c)
}

@bits01
Copy link
Author

bits01 commented Dec 16, 2015

Yes, I know that. The example is on purpose to show the error message. The bug is about the error message itself. Type C.unsignedchar doesn't exist, the error message should read "type C.uchar"

@mattn
Copy link
Member

mattn commented Dec 16, 2015

sorry misunderstanding.

@ianlancetaylor ianlancetaylor changed the title Some cgo messages mention C.unsignedchar but that is not a valid type cmd/cgo: some cgo messages mention C.unsignedchar but that is not a valid type Dec 16, 2015
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Dec 16, 2015
@minux minux self-assigned this Dec 16, 2015
@gopherbot
Copy link
Contributor

CL https://golang.org/cl/17863 mentions this issue.

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