X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=gcc%2Ftestsuite%2Fg%2B%2B.old-deja%2Fg%2B%2B.brendan%2Fcrash47.C;fp=gcc%2Ftestsuite%2Fg%2B%2B.old-deja%2Fg%2B%2B.brendan%2Fcrash47.C;h=0000000000000000000000000000000000000000;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=9bdbb11ab3d345b450464bb5c839b31e3fe3d7f8;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash47.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash47.C deleted file mode 100644 index 9bdbb11a..00000000 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash47.C +++ /dev/null @@ -1,94 +0,0 @@ -// Build don't link: -// GROUPS passed old-abort -const int TRUE = 1; -const int FALSE = 0; - -class Rep { -protected: - Rep(): count(0) - { } - Rep(const Rep& other): count(0) - { } - - Rep& operator=(const Rep& other) - { /* DO NOT copy over other.count */ - return *this; } - -public: // TODO - for now - // Because it is to hard to restrict these operations to the descendants - // of Rep that we haven't named yet. So we just make them public. - void inc() - { count++; } - void dec() - { if (0 == --count) delete this; } -private: - unsigned count; -}; - -template -class Ref { -public: - Ref(): rep(0) - { } - Ref(const Ref& other): rep(other.rep) - { if (rep) rep->inc(); } - ~Ref() - { if (rep) rep->dec(); - rep = 0; } - - Ref& operator=(const Ref& other) - { if (rep != other.rep) { - if (rep) rep->dec(); - rep = other.rep; - if (rep) rep->inc(); } - return *this; } - - bool null() const - { return 0 == rep ? TRUE: FALSE; } - bool valid() const - { return 0 != rep ? TRUE: FALSE; } - - REP* operator->() const // should be a valid() reference - { return rep; } - operator REP*() const; // should be a valid() reference - -protected: - REP *rep; - - Ref(REP *r): rep(r) - { if (rep) rep->inc(); } - - Ref& operator=(REP *r) - { if (rep != r) { - if (rep) rep->dec(); - rep = r; - if (rep) rep->inc(); } - return *this; } -}; - -template -Ref::operator REP*() const // should be a valid() reference -{ return rep; } - -template -inline int -operator==(const Ref& a, const Ref& b) -{ return (REP *) a == (REP *) b; } - -template -inline int -operator!=(const Ref& a, const Ref& b) -{ return (REP *) a != (REP *) b; } - -class XRep: public Rep { -public: - int i; -}; - -int -main() -{ - Ref y; - - return y != y; -}