Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 32,720 of 33,346    |
|    Thomas Richter to All    |
|    Re: Conversion, operator overloading    |
|    11 Dec 12 22:19:39    |
   
   From: thor@math.tu-berlin.de   
      
   On 11.12.2012 21:30, TS wrote:   
      
   > recently I got a problem related to conversion and operator overloading.   
   > With the code below   
   >   
   > class A {};   
   > A operator +(const A& lhs, const A& rhs) { ... };   
   >   
   > class B {   
   > public:   
   > operator A() { ... }   
   > operator int() { ... }   
   > };   
      
   > I got the error from gcc:   
   > error: ambiguous overload for ‘operator+’ in ‘ba + bb’   
   > note: candidates are: operator+(int, int)
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca