|
From: SF/projects/mingw n. l. <min...@li...> - 2011-01-09 12:05:35
|
Bugs item #3153599, was opened at 2011-01-09 14:05 Message generated for change (Tracker Item Submitted) made by mixpro You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=3153599&group_id=2435 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: gcc Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: mIXpRo mixpro (mixpro) Assigned to: Nobody/Anonymous (nobody) Summary: g++ doesn't use default constructor properly Initial Comment: hii , #include<iostream> using namespace std; class rational{ int a; public: rational(int a=1):a(a){} ~rational(){} friend bool operator ==(const rational&,const rational&); }; bool operator==(const rational& a,const rational& b){ return (a.a==b.a) ; } int main(){ rational c,d; bool x = c==d; bool y = 1==c; cout << x << y <<endl; return 0; } i tried to compile this code on g++ without any other flag , but gave me : couldn't find operator== for (1==c) or something like that . but this code should work properly , i have a default constructor . so when callinng (1==c) 1 should be casted as a rational and compared . i tried this in linux terminal and it worked fine . ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=3153599&group_id=2435 |