Skip to content

cmd/cgo: compiler error for C unsigned short is wrong. #13129

@ghost

Description

When trying to assign a variable of the wrong type to a C.ushort. The compiler will emit the error cannot use <var> (type <var type>) as type C.unsignedshort in assignment. However C.unsignedshort isn't even a real type. It should say C.ushort

short test program:
package main

import "C"

func main() {
    var x C.ushort
    y := 5
    x = y // ./bug.go:8: cannot use y (type int) as type C.unsignedshort in assignment
    //var z C.unsignedshort // could not determine kind of name for C.unsignedshor
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions