[Bug c++/23904] New: Const function selection
class OtherClass; class MyClass { public: const OtherClass* GetOther() const { return ( m_other_p ); } protected: OtherClass* GetOther() { return ( m_other_p ); } OtherClass *m_other_p; friend class FriendClass; }; In this case friend classes are allowed to access non-const data, but other classes can only access the const data. The problem is that the compiler does not recognize that other classes can call the GetOther() const function. It only tries to use the non-const version and reports that the function is protected. The two classes do have different C-V qualifiers so they have different signatures. There is a workaround for this bug that you can declare a pointer to a const MyClass and then call GetOther() which forces the compiler to look for a const version of the function. -- Summary: Const function selection Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dsell at agleader dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23904
[Bug c++/23298] New: Float value assignements differ when inside a for loop
r -3654766718615552.00 -85911792 * 42540895 = -3654764571131904.00 or -3654764571131904.00 -85911877 * 42540731 = -3654754102149120.00 or -3654754370584576.00 -85911996 * 42540613 = -3654749270310912.00 or -3654749001875456.00 -85912216 * 42540335 = -3654734506360832.00 or -3654734506360832.00 -85912609 * 42540178 = -3654737727586304.00 or -3654737459150848.00 -85912778 * 42539993 = -3654728869216256.00 or -3654728869216256.00 -85912884 * 42539795 = -3654716252749824.00 or -3654716521185280.00 -85912924 * 42538217 = -3654582840328192.00 or -3654582571892736.00 -85912974 * 42537898 = -3654557338959872.00 or -3654557338959872.00 -85911106 * 42537898 = -3654477882064896.00 or -3654477613629440.00 -- The sample code was built with the following make file: floatcast: floatcast.cpp g++ -o floatcast floatcast.cpp --- -- Summary: Float value assignements differ when inside a for loop Product: gcc Version: 3.4.3 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dsell at agleader dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23298
[Bug c++/23298] Float value assignements differ when inside a for loop
--- Additional Comments From dsell at agleader dot com 2005-08-09 20:24 --- We did come to the realization that we should be using doubles to store the values, because the values we were comparing were really too large for floats. However, the fact that rearranging the code or compiling on one platform vs another could cause different results seemed to be wrong behaivour. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23298