-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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
'invalid recursive type' error (may be 582 again?) #667
Labels
Comments
Are you sure you have an up-to-date compiler? ; cat >x.go package gtk type _Cstruct__GList struct { next *_C_GList prev *_C_GList } ; 6g x.go x.go:5: undefined: _C_GList ; 8g x.go x.go:5: undefined: _C_GList ; Owner changed to r...@golang.org. Status changed to WaitingForReply. |
Oops, I had missed the last line of the test file when copying. Should be: ; cat <<END >x.go // Created by cgo - DO NOT EDIT package gtk type _Cstruct__GList struct { next *_C_GList prev *_C_GList } type _C_GList _Cstruct__GList END I've run all.bash again and it definiteley fails on that version of the compiler , which was up to date as of when I submitted. |
Firstly - I've submitted a (working) patch for this. Yay! Though it probably needs some work to clean up the code. Secondly - I think it's clearer to look at the more general perspective of the problem - it arises when you declare a type literal which copies the contents of a type *that type* is referenced in via a pointer. Ok, probably clearer via examples. The simplest:- type Foo struct { next *Bar } type Bar Foo Which raises the compiler error 'invalid recursive type Bar' Now, (prior to the patch), if you actually declared this as follows:- type Bar Foo type Foo struct { next *Bar } It would compile fine. We can actually extend this to a couple of other cases which cause further trouble when trying to fix this problem:- type Foo struct { next *Bar } type Bar Baz type Baz Blah type Blah Foo And something like this:- type Foo struct { next struct { x *struct { y *****struct { z struct { argh Bar } } } } } type Bar Foo |
irstly - I've submitted a (working) patch for this. Yay! Though it probably needs some work to clean up the code. Secondly - I think it's clearer to look at the more general perspective of the problem - it arises when you declare a type literal which copies the contents of a type in which itself is referenced to via a pointer. Ok, probably clearer via examples. The simplest:- type Foo struct { next *Bar } type Bar Foo Which raises the compiler error 'invalid recursive type Bar' Now, (prior to the patch), if you actually declared this as follows:- type Bar Foo type Foo struct { next *Bar } It would compile fine. We can actually extend this to a couple of other cases which cause further trouble when trying to fix this problem:- type Foo struct { next *Bar } type Bar Baz type Baz Blah type Blah Foo And something like this:- type Foo struct { next struct { x *struct { y *****struct { z struct { argh Bar } } } } } type Bar Foo |
Firstly - I've submitted a (working) patch for this. Yay! Though it probably needs some work to clean up the code. Secondly - I think it's clearer to look at the more general perspective of the problem - it arises when you declare a type literal which copies the contents of a type in which itself is referenced to via a pointer. Ok, probably clearer via examples. The simplest:- type Foo struct { next *Bar } type Bar Foo Which raises the compiler error 'invalid recursive type Bar' Now, (prior to the patch), if you actually declared this as follows:- type Bar Foo type Foo struct { next *Bar } It would compile fine. We can actually extend this to a couple of other cases which cause further trouble when trying to fix this problem:- type Foo struct { next *Bar } type Bar Baz type Baz Blah type Blah Foo And something like this:- type Foo struct { next struct { x *struct { y *****struct { z struct { argh Bar } } } } } type Bar Foo |
Issue #1672 has been merged into this issue. |
This issue was closed by revision b6f0632. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by ajb44.geo:
The text was updated successfully, but these errors were encountered: