Home Dashboard Directory Help
Search

Access to private members in a C++ Class from outside is allowed without compile errors (VS2012) by Herwig Bachner


Status: 

Closed
 as Deferred Help for as Deferred


1
1
Sign in
to vote
Type: Bug
ID: 774022
Opened: 12/11/2012 6:00:30 AM
Access Restriction: Public
1
Workaround(s)
view
1
User(s) can reproduce this bug

Description

if I use a private declared member in a class the compiler ignores this and compiles this without any warnings or errors. Only VS2012 intellisense marks this as an error. I thing this a bug.

Details
Sign in to post a comment.
Posted by Microsoft on 12/11/2012 at 6:14 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 12/11/2012 at 6:51 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by UnitUniverse on 12/15/2012 at 5:01 PM
class class1{
private:
union {
struct{
unsigned a:8;
unsigned b:8;
unsigned c:4;
unsigned d:4;
unsigned e:8;
}tagi;
unsigned int l;
}tago;
public:
class1(){tago.l=0;}
};


void functionxy(){
class1 x;
x.tago.l = 0x0; // C2248
x.tago.tagi.c |= 0x03; // C2248
}