After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 787091 - Vala generates invalid C code with SimpleType structures defined as arrays
Vala generates invalid C code with SimpleType structures defined as arrays
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Structs
unspecified
Other Windows
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2017-08-31 16:03 UTC by smxdev4
Modified: 2018-05-22 15:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (2.69 KB, patch)
2017-08-31 16:03 UTC, smxdev4
none Details | Review

Description smxdev4 2017-08-31 16:03:03 UTC
Created attachment 358866 [details] [review]
proposed patch

If the struct being moved is an array, and was declared as [SimpleType], the generated code will fail to compile with

error: assignment to expression with array type

This happens because the left part of the assignment is an array, and as such it's not directly modifiable.

The first idea was to use a custom copy_function, but Vala ignores it in these cases.

The attached patch adds handling for a copy_function with this prototype, if provided by the user:

void foo_copy(foo source, foo dest);

thanks to Rico Tzschichholz for wrapping up a unit test
Comment 1 GNOME Infrastructure Team 2018-05-22 15:52:06 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/595.