cmd/cgo: const in c translate to go const without obey original type. #64923
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
Go version
go version go1.21.5 darwin/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
reg2expand.go
❯ go build ./reg2expand.go # command-line-arguments ./reg2expand.go:12:20: (_Ciconst_const1) (untyped int constant -1) overflows uint64
1. compile error happen when:
a unsigined type c const with a value bigger than go math.MaxInt.
when this translated const compare with same type c variable or const.
2.why
cgo translate a const in this case to a negative value.
_cgo_gotypes.go
3. questiont source
c pcre2 library has a const named PCRE2_UNSET.
when check whether a group is set come with compiler error.
4. temp workaround
define a same type variable whith the const value.
What did you expect to see?
_cgo_gotypes.go
What did you see instead?
_cgo_gotypes.go
The text was updated successfully, but these errors were encountered: