-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Fix "non-trivial designated initializers not supported" errors #117
Conversation
With g++ v7.3.1 (used with Amazon Linux 2), compiling the extension would fail with these errors: ``` compiling re2.cc re2.cc:176:1: sorry, unimplemented: non-trivial designated initializers not supported }; ^ re2.cc:221:1: sorry, unimplemented: non-trivial designated initializers not supported }; ^ re2.cc:251:1: sorry, unimplemented: non-trivial designated initializers not supported }; ^ re2.cc:1610:1: sorry, unimplemented: non-trivial designated initializers not supported }; ^ ``` This appears to be happening because the `parent` and `data` fields in `rb_data_type_struct` were omitted.
Thanks for raising this, @stanhu. Am I right in thinking support for designated initialisers in C++ is a bit uncertain? Would we instead be better using the more "boring" form with only ordered expressions ala https://github.com/ruby/ruby/blob/60e19a0b5fc9c067ee88751192dc56da618f5060/weakmap.c#L151-L160? For reference, here are the two versions of |
As support for designated initializers in C++ is unclear, use purely positional initializers for rb_data_type_t structs to improve compatibility.
@stanhu I've pushed a commit to switch away from designated initializers: can you please test this and let me know if it works with g++ 7.3.1? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I managed to reproduce this using the gcc:7.3
Docker image and confirm switching away from designated initializers fixes this for both Ruby 2.6 and Ruby 2.7+.
Sounds good, thanks! |
I've now published 2.4.3 to fix this. Please let me know if there are any other issues! |
@byroot this issue and the two potential fixes (see the two commits) may be of interest to you if you’re trying to convert other C++ extensions from |
Thanks for the ping, this is good to know. But hopefully there isn't too many of those around 😄 |
With g++ v7.3.1 (used with Amazon Linux 2), compiling the extension would fail with these errors:
This appears to be happening because the
parent
anddata
fields inrb_data_type_struct
were omitted.According to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55606, this issue was fixed in GCC 8.