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

gc drops struct fields after type error #2110

Closed
dsymonds opened this issue Jul 27, 2011 · 4 comments
Closed

gc drops struct fields after type error #2110

dsymonds opened this issue Jul 27, 2011 · 4 comments

Comments

@dsymonds
Copy link
Contributor

I have a struct with over three hundred fields (it's a protocol buffer), and 6g seems to
silently drop the later fields, yielding a compilation error in the same file about an
undefined field (specifically the internal-use XXX_extensions field).

Experimenting with the struct reveals that it breaks down somewhere between 250 and 280
fields (256 perhaps?).

I'll try to whip up a test case.
@dsymonds
Copy link
Contributor Author

Comment 1:

I misled myself. A previous field in the struct referenced a type in a different package
that could not be imported (and I got an error for that), but then the compiler ignored
the remainder of the struct and gave me the misleading error message.
So this is still an unhelpful compile error, but it's not as bad as I thought.

Labels changed: added priority-medium, removed priority-high.

@robpike
Copy link
Contributor

robpike commented Jul 27, 2011

Comment 2:

what message? and please provide an example. it's hard to do much in response to this
report.

@dsymonds
Copy link
Contributor Author

Comment 3:

Here's an example program:
----------
package main
type S struct {
    err os.Error
    Num int
}
func main() {
    s := S{}
    _ = s.Num
}
----------
The compiler output is
  prog.go:4: undefined: os
  prog.go:10: s.Num undefined (type S has no field or method Num)
The first one is the most pertinent, but the second is just misleading, and not
obviously the cause.

@rsc
Copy link
Contributor

rsc commented Jul 29, 2011

Comment 4:

This issue was closed by revision 032ffb2.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
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

4 participants