GNOME Bugzilla – Bug 661510
Access specifiers in structs aren't respected.
Last modified: 2016-12-01 10:45:56 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.
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.
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