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]

[Bug c++/22132] Wrong code: upcasting a const class pointer to struct the class derives from


------- Additional Comments From scott dot tupaj at line6 dot com  2005-06-21 17:01 -------
Yes, agreeably this is 'bad' c++ practice in my example.  However, if wrong 
code is produced, I think it would be prudent for at least a compiler warning 
or error be produced if the reason for wrong code is because invalid or 
questionable c++ syntax is being used.  

Every other compiler I've used, including gcc 3.x.x doesn't not corrupt access 
to the members in this scenario like gcc 4.0.0 does.  Other compilers either 
error because of the const violation, or accepts it and produces the proper 
results when accessing the pointer.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22132


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