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 661510 - Access specifiers in structs aren't respected.
Access specifiers in structs aren't respected.
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Structs
0.14.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2011-10-12 00:38 UTC by clinton
Modified: 2016-12-01 10:45 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description clinton 2011-10-12 00:38:48 UTC
Steps to reproduce:

1) Attempt to compile the following short program:
//-------------------------------------------------------
struct GLITCH
{
    private int i;
}

void main()
{
    GLITCH bad_access = GLITCH();
    bad_access.i = 4;
}
//-------------------------------------------------------
...and observe the results.

Notice that the above is accepted by the compiler without complaint, even though a non-member method is directly modifying a private member.
Comment 1 Luca Bruno 2011-10-12 13:02:13 UTC
It's not possible to have private struct members (there's no priv pointer like for classes), the compiler must throw an error. I'm not sure though, whether it's only about C or generally for structs.
Comment 2 Rico Tzschichholz 2016-12-01 10:45:56 UTC
commit e0adb081fc11e563b037e19b2b85bcdc93a437c3
Author: Luca Bruno <lucabru@src.gnome.org>
Date:   Thu Aug 14 14:28:21 2014 +0200

    parser: Report error only for private instance fields in structs