[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
GCC 3.0 / empty base class optimization
From: |
Helmut Zeisel |
Subject: |
GCC 3.0 / empty base class optimization |
Date: |
25 Jul 2001 10:07:33 -0700 |
"c++ mytest.cpp; a.out" compiled with GCC 3.0 / Linux crashes.
"c++ -DNONEMPTY mytest.cpp; a.out" works.
This seems to be a bug w.r.t. the empty base class optimization.
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;
}
- GCC 3.0 / empty base class optimization,
Helmut Zeisel <=