www.digitalmars.com         C & C++   DMDScript  

c++.beta - illegal operand types: inline friend operator

template<class T>
struct C
{
  friend bool operator !=(const T &x, const T &y)
  { return !(x == y); }
  // Error: illegal operand types
  // Had: const B
  // and: const B
};

template<class T>
struct A
  : public C<T>
{
  bool operator ==(const T &t) const
  {
    return false;
  }
};

struct B
  : public A<B>
{ };

int main()
{
  B b1, b2;

  return (b1 == b2);
}


Extracted from Boost's date_time library.


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw jabber.at
mailto cmeerw at web.de

...and what have you contributed to the Net?
Oct 05 2003