-
Notifications
You must be signed in to change notification settings - Fork 707
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
derive(Debug) on struct containing array that is too big for derive(Debug) #372
Comments
This is a nasty consequence of us trying to do the best we can to guarantee correct layout. When we find a type with non-type template parameters, we generate a blob of memory. Of course, we don't check that with We should. We can go safe and just return false if the type had any non-type template parameters, or we can factor out the logic from We should probably do the same for |
@fitzgen do yo want to tackle or mentor this bug? |
I can take it. |
I'm still getting this error while trying to run
I'm using bindgen version 0.26.2 on windows. Any ideas? |
That's a different issue, and it deserves another bug, I think. That's when generating padding for a struct, which is a different case. I can file as soon as I arrive home. |
I'm getting some relative of this. I am translating some reasonably big C++ class, and i tried making it opaque to make my life easier:
But this fails to compile:
If i make the type non-opaque, it comes out like this:
Which also fails:
The latter case looks similar to @64's bug. I wonder if this is related to #648? I can work around this by setting As an aside, should there really be 37 64-bit words of padding? I don't know much about C++ object layout at all, but that surprised me. |
@tomwhoiscontrary would you mind filing a new issue and including a test case so we can reproduce the issue locally? Thanks! |
I'll see what i can do about a test case. The code i'm binding is pretty huge, so i'll need to extract a subset which exhibits the problem. |
This is where C-Reduce and |
@emilio |
FYI, this is what I'm getting after upgrading to 1.39:
|
@martinthomson / @mmacedoeu do you have a test-case for that? |
Not really a short test-case, It is a closed source code, but It seams any attempt to generate bindgen where a window.h header is present lead to this. I will have some time soon to try and isolate the problem. Is there any tool that could help automate the test-case ? |
Yeah, you can use |
The test case is from neqo, but shove this in a header: struct Test {
char test[104];
}; |
I cannot reproduce that, is there any chance you're using a combination of:
If so, that's #1627 / rust-lang/rust#64710. |
Yeah, that's it. Thanks. It was 0.51.0. I'll get the latest. |
$ ./target/debug/bindgen --enable-cxx-namespaces test.hpp > test.rs
Here is
test.hpp
(really really nasty):Here is the generated
test.rs
bindings:And when we try to compile the bindings, we get this error:
The text was updated successfully, but these errors were encountered: