Boost logo

Boost :

From: helmut.zeisel_at_[hidden]
Date: 2001-07-25 12:11:29


There seems to be a bug w.r.t. the
empty base class optimization in GCC 3.0
which makes operators.hpp more or less unuseable:

"c++ mytest.cpp; a.out" compiled with GCC 3.0 / Linux crashes.
"c++ -DNONEMPTY mytest.cpp; a.out" works.

Helmut

     class empty_base
     {
     #ifdef NONEMPTY
       int i;
     #endif
     };

     template <class T, class B = empty_base>
     struct multipliable1 : B
     {
          friend T operator*(T x, const T& y) { return x *= y; }
     };

     class A : multipliable1<A >
     {
     public:
       A(int n) {m_v.push_back(0);}

       A& operator*=(const A& other) {return *this;}
     private:
       std::vector<int> m_v;
     };

     int main()
     {
       A a(1);
       A(1)*A(1);
       a=1;
       return 0;
     }


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk