This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/3820: GCC 3.0 crashes with empty base class
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/3820: GCC 3.0 crashes with empty base class
- From: helmut dot zeisel at aon dot at
- Date: 25 Jul 2001 20:31:18 -0000
- Reply-To: helmut dot zeisel at aon dot at
>Number: 3820
>Category: c++
>Synopsis: GCC 3.0 crashes with empty base class
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Wed Jul 25 13:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Helmut Zeisel
>Release: 3.0
>Organization:
>Environment:
Linux 2.2.X (SuSE)
>Description:
"c++ mytest.cpp; a.out" compiled with GCC 3.0 / Linux crashes.
>How-To-Repeat:
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;
}
>Fix:
"c++ -DNONEMPTY mytest.cpp; a.out" works.
>Release-Note:
>Audit-Trail:
>Unformatted: