This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Public / Private in headers


Ferdinando Formica wrote:
I don't know if you consider this a bug, nor if it's been fixed in recent
versions of GCC, but I experienced this: when compiling a C++ module with
a class definition, member's names are exported without regard to their
visibility modificators. So, if I link that module with another containing
(and using) same members, but all declared public, I can access and modify
a class' internal structure: now, I know, I made the class and declaring
it in a different way is like shoot me in the foot, but this give me the
chance to create a derived class that can export as public the members
declared as private by its parent, in contrast with standard's
specifications, as far as I know.
You have broken the One Definition Rule, and hence invoked undefined effects.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
         The voices in my head said this was stupid too
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]