You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
int main() {
struct node { int kind; int val; };
typedef struct node node;
node n;
n.kind = 10;
n.val = 20;
return n.kind;
}
Go (current)
// Warning (TypedefDecl): %!s(int=3): cannot use TypedefDecl for DeclStmt
// Warning (VarDecl): %!s(int=5): I couldn't find an appropriate Go type for the C type 'node'.
// Warning (MemberExpr): %!s(int=6): I couldn't find an appropriate Go type for the C type 'node'.
// Warning (MemberExpr): %!s(int=6): cannot determine type for LHS 'node', will use 'void *' for all fields
// Warning (MemberExpr): %!s(int=7): I couldn't find an appropriate Go type for the C type 'node'.
// Warning (MemberExpr): %!s(int=7): cannot determine type for LHS 'node', will use 'void *' for all fields
// Warning (MemberExpr): %!s(int=8): I couldn't find an appropriate Go type for the C type 'node'.
// Warning (MemberExpr): %!s(int=8): cannot determine type for LHS 'node', will use 'void *' for all fields
package main
import "os"
import "github.com/elliotchance/c2go/noarch"
type __int128_t int64
type __uint128_t uint64
func main() {
__init()
var n interface {
}
n.kind = 10
n.val = 20
os.Exit(noarch.ByteSliceToInt(n.kind))
}
func __init() {
}
The text was updated successfully, but these errors were encountered:
It looks like the struct cannot be defined inside a function. If I move both the struct definition and the typedef outside the function then it works:
C
struct node { int kind; int val; };
typedef struct node node;
int main() {
node n;
n.kind = 10;
n.val = 20;
return n.kind;
}
Go
package main
import "os"
type __int128_t int64
type __uint128_t uint64
type node struct {
kind int
val int
}
func main() {
__init()
var n node
n.kind = 10
n.val = 20
os.Exit(n.kind)
}
func __init() {
}
C
Go (current)
The text was updated successfully, but these errors were encountered: