This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/3820: GCC 3.0 crashes with empty base class



>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]