OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/gnu-old/gcc-4.2.2/gcc/testsuite/g++.old-deja/g++.mike
    from Rev 154 to Rev 816
    Reverse comparison

Rev 154 → Rev 816

/warn7.C
0,0 → 1,14
// { dg-do assemble }
// { dg-options "-Wall" }
 
const int& foo() {
extern int bar;
return bar;
}
 
const int* baz() {
extern int bar;
return &bar;
}
warn7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net44.C =================================================================== --- net44.C (nonexistent) +++ net44.C (revision 816) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Make sure we don't dump core + +enum request { q, w, e}; // { dg-error "" } + +class request { // { dg-error "" } +public: + int a; + request( int b) { + a = b; + }; +};
net44.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: sizeof.C =================================================================== --- sizeof.C (nonexistent) +++ sizeof.C (revision 816) @@ -0,0 +1,9 @@ +// { dg-do compile } + +class Foo { + int children[4]; +public: + unsigned function(void) { + return sizeof (((Foo*)0)->children); + } +};
sizeof.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net27.C =================================================================== --- net27.C (nonexistent) +++ net27.C (revision 816) @@ -0,0 +1,9 @@ +// { dg-do assemble } + +class path { +public: + path (const path& r) + { "\""; + '\''; + } +};
net27.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh40.C =================================================================== --- eh40.C (nonexistent) +++ eh40.C (revision 816) @@ -0,0 +1,29 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +int fail = 1; +class B { +public: + B() { throw 1; } +}; +class D : public B { +public: + D() try : B() { + fail = 1; + } catch (char c) { + fail = 1; + throw; + } catch (...) { + fail = 0; + throw; + } +}; + +main() { + try { + D d; + fail = 1; + } catch (...) { + } + return fail; +}
eh40.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh23.C =================================================================== --- eh23.C (nonexistent) +++ eh23.C (revision 816) @@ -0,0 +1,47 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +#include +#include + +struct double_fault { }; +int fault_now; + +class E { +public: + E() { } + E(const E&) { + if (fault_now) + throw double_fault(); + } +}; + +void foo() { + try { + throw E(); + } catch (...) { + fault_now = 1; + throw; + } +} + +void bar() { + try { + foo(); + } catch (E e) { // double fault here + } +} + +void my_terminate() { + exit (0); // double faults should call terminate +} + +main() { + std::set_terminate (my_terminate); + try { + bar(); + } catch (...) { + return 1; + } + return 1; +}
eh23.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: s9959.C =================================================================== --- s9959.C (nonexistent) +++ s9959.C (revision 816) @@ -0,0 +1,20 @@ +// { dg-do assemble } + +class A { +protected: + int aData; +}; + +class B : public A { +public: + virtual void func1() { + A::aData = 1; + } +}; + +class C : virtual public B { +public: + virtual void func1(void) { + A::aData = 2; + } +};
s9959.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: rtti2.C =================================================================== --- rtti2.C (nonexistent) +++ rtti2.C (revision 816) @@ -0,0 +1,6 @@ +// { dg-do run } +#include + +int main() { + typeid(bool); +}
rtti2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p11667.C =================================================================== --- p11667.C (nonexistent) +++ p11667.C (revision 816) @@ -0,0 +1,62 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } +// prms-id: 11667 + +extern "C" int printf(const char *,...); + +template < class T > +class LIST { +public: + + LIST() { nitems = 16; items = new T[nitems]; }; + + LIST(int u) { nitems = u; items = new T[nitems]; }; + + T& operator[](int i) const { + return items[i]; + } + + void grow(int n) { + T* newlist = new T[n]; + T* src = items; + T* dst = newlist; + int i = nitems; + + try { + while (i--) *dst++ = *src++; + } catch (...) { + delete[] newlist; + throw; + } + + if (items) delete[] items; + nitems = n; + items = newlist; + } + +private: + int nitems; + T *items; +}; + +int main(int argc, char **argv) { + int i; + LIST mylist(10); + + printf("Start dumping initial 10 item list\n"); + for (i = 0; i < 10 ; i++) { + mylist[i] = i; + printf("%d\n", mylist[i]); + } + + printf("Growing list to 20\n"); + mylist.grow(20); + + printf("Start dumping grown 20 item list\n"); + for (i = 0; i < 20; i++) { + mylist[i] = i; + printf("%d\n", mylist[i]); + } + + return 0; +}
p11667.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p789.C =================================================================== --- p789.C (nonexistent) +++ p789.C (revision 816) @@ -0,0 +1,29 @@ +// { dg-do run } +// prms-id: 789 + +extern "C" int printf (const char *, ...); +struct foo +{ + static int count; + virtual void print (int i, int j) { printf ("foo[%d][%d] = %d\n", i, j, x); } + int x; + foo () { x = count++; } +}; +int foo::count; +struct bar : virtual public foo +{ + virtual void print (int i, int j) { printf ("bar[%d][%d] = %d\n", i, j, x); } +}; + +// bar array[3][3]; +foo array[3][3]; + +int main () +{ + for (int i = 0; i < 3; i++) + for (int j = 0; j < 3; j++) { +// printf("&a[%d][%d] = %x\n", i, j, (void *)&array[i][j]); + array[i][j].print (i, j); + } + return 0; +}
p789.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh48.C =================================================================== --- eh48.C (nonexistent) +++ eh48.C (revision 816) @@ -0,0 +1,34 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +#include +#include + +using std::uncaught_exception; +class A { +public: + ~A() { + if (uncaught_exception ()) + exit (0); + } +}; + +int main() { + if (uncaught_exception ()) + return 1; + try { + throw ""; + } catch (...) { + if (uncaught_exception ()) + return 1; + } + if (uncaught_exception ()) + return 1; + try { + A a; + throw ""; + } catch (...) { + return 1; + } + return 1; +}
eh48.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: virt5.C =================================================================== --- virt5.C (nonexistent) +++ virt5.C (revision 816) @@ -0,0 +1,54 @@ +// { dg-do run } +// Ensure that virtual base upcast and downcasting works on this +// conversions during virtual function dispatch at ctor/dtor time +// when dynamic vtable fixups for deltas are needed. + +int fail = 0; + +struct BASE1 { + virtual ~BASE1 () { } +}; + +class MID; + +class BASE2 { +public: + virtual MID *VFN (){ return 0; } +}; + +class MIBASE : public BASE1, public BASE2 { }; + +class VBB : public MIBASE { +public: + virtual long get_STATE () const = 0; + void print_STATE() { if (get_STATE () != 87654321) fail = 1; } +}; + +class VBD : public virtual VBB { + long STATE; +public: + long get_STATE() const { return STATE; } + VBD() { STATE = 87654321; } + ~VBD() { STATE = 87654321; } +}; + +class MID : public virtual VBD { +public: + MID () { print_STATE(); } + ~MID () { print_STATE(); } + virtual MID *VFN() { return this; } +}; + +class LAST : public MID { +public: + LAST () { print_STATE(); } + ~LAST () { print_STATE(); } +}; + +int main() { + MIBASE *o = new LAST; + MID *p = o->VFN(); + p->print_STATE(); + delete o; + return fail; +}
virt5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p2431.C =================================================================== --- p2431.C (nonexistent) +++ p2431.C (revision 816) @@ -0,0 +1,23 @@ +// { dg-do assemble } +// GROUPS passed infinite_loop +class A +{ + public: + A(A &); // { dg-error "" } candidates are +}; + +class B +{ + public: + operator A (); +}; + +class C +{ + public : + C() + { + B b; + A a = b;// { dg-error "" } + } +};
p2431.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3060d.C =================================================================== --- p3060d.C (nonexistent) +++ p3060d.C (revision 816) @@ -0,0 +1,35 @@ +// { dg-do run } +// This is a test case to make sure the explicit cast on a pointer to +// a member function works ok. +// prms-id: 3060 + +extern "C" int printf(const char *, ...); + +class Object; + +typedef void (Object::*VoidObjMemberFunc)(Object *tracker, void *ap); + +class Object { +public: + int foo; +}; + +class Clipper: public Object { +public: + int bar; + void Feedback(Object*, void*); +}; +void Clipper::Feedback(Object *tracker, void *ap) { + printf("Doing feedback\n"); +} + +void vfunc(VoidObjMemberFunc of, Object *op, void *v1) { + (op->*of)(op, v1); +} + +int main() { + Object o; + + vfunc((VoidObjMemberFunc)&Clipper::Feedback, &o, 0); + return 0; +}
p3060d.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4238.C =================================================================== --- p4238.C (nonexistent) +++ p4238.C (revision 816) @@ -0,0 +1,7 @@ +// { dg-do assemble } +// This showed a problem with default op= +// prms-id: 4238 + +struct sigcontext { + int sc_wbuf[31][25]; +}; // { dg-bogus "" } default op= seems broken
p4238.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p5840.C =================================================================== --- p5840.C (nonexistent) +++ p5840.C (revision 816) @@ -0,0 +1,36 @@ +// { dg-do run } +// prms-id: 5840 + +class Signal { +public: + int Name(void) { return 1; } +}; + +class Derived : public Signal { +public: + int Name(void) { return 2; } +}; + +template +class Bar +{ +public: + int value (Foo* a) { return (a->*Id)(); } +}; + +/* The following line is illegal under the new rules for non-type + template arguments in the standard, so it is commented out. */ +/* template class Bar ; */ +template class Bar ; +template class Bar ; + +Derived a; + +/* Bar dispatcher1; */ +Bar dispatcher2; + +int main() { + /* int i1 = dispatcher1.value(&a); */ + int i2 = dispatcher2.value(&a); + return /* i1 != 1 || */ i2 != 2; +}
p5840.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns10.C =================================================================== --- ns10.C (nonexistent) +++ ns10.C (revision 816) @@ -0,0 +1,10 @@ +// { dg-do run } +namespace Foo { + int bar() { + return 0; + } +} + +int main() { + return Foo::bar(); +}
ns10.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p8155.C =================================================================== --- p8155.C (nonexistent) +++ p8155.C (revision 816) @@ -0,0 +1,148 @@ +// { dg-do run } +// prms-id: 8155 + +int fail = 1; + +class CMainWindow; +class CFrameWnd; +class CWnd; +class CCmdTarget; + +typedef void (CCmdTarget::*AFX_PMSG)( void); +typedef void (CWnd::*AFX_PMSGW)( void); + +struct AFX_MSGMAP_ENTRY { + unsigned int nMessage; + AFX_PMSG pfn; +}; + +struct AFX_MSGMAP { + const AFX_MSGMAP* pBaseMap; + const AFX_MSGMAP_ENTRY* lpEntries; +}; + +class CCmdTarget { +public: + CCmdTarget(); +private: + static AFX_MSGMAP_ENTRY _messageEntries[]; +protected: + static const AFX_MSGMAP messageMap; + virtual const AFX_MSGMAP* GetMessageMap() const; +}; + +const AFX_MSGMAP CCmdTarget::messageMap = { + 0, &CCmdTarget::_messageEntries[0] +}; + +const AFX_MSGMAP* CCmdTarget::GetMessageMap() const { + return &CCmdTarget::messageMap; +} + +AFX_MSGMAP_ENTRY CCmdTarget::_messageEntries[] = +{ + { 0, 0 } +}; + +CCmdTarget :: CCmdTarget() { } + +class CWnd : public CCmdTarget { +public: + CWnd(); + +protected: + void OnPaint(); +private: + static AFX_MSGMAP_ENTRY _messageEntries[]; +protected: + static const AFX_MSGMAP messageMap; + virtual const AFX_MSGMAP* GetMessageMap() const; +}; + +CWnd :: CWnd() { +} + +void CWnd :: OnPaint() { +} + +const AFX_MSGMAP* CWnd ::GetMessageMap() const { + return & CWnd ::messageMap; +} +const AFX_MSGMAP CWnd ::messageMap = { + & CCmdTarget ::messageMap, & CWnd ::_messageEntries[0] + }; +AFX_MSGMAP_ENTRY CWnd ::_messageEntries[] = { + {0, (AFX_PMSG)0 } }; + +class CFrameWnd : public CWnd { +public: + CFrameWnd(); +protected: +private: + static AFX_MSGMAP_ENTRY _messageEntries[]; +protected: + static const AFX_MSGMAP messageMap; + virtual const AFX_MSGMAP* GetMessageMap() const; +}; + +CFrameWnd :: CFrameWnd() { } + +const AFX_MSGMAP* CFrameWnd ::GetMessageMap() const { + return & CFrameWnd ::messageMap; +} +const AFX_MSGMAP CFrameWnd ::messageMap = { + & CWnd ::messageMap, & CFrameWnd ::_messageEntries[0] + }; +AFX_MSGMAP_ENTRY CFrameWnd ::_messageEntries[] = { + {0, (AFX_PMSG)0 } }; + +class CMainWindow : public CFrameWnd { +public: + CMainWindow(); + void OnPaint(); + void callProc(); +private: + static AFX_MSGMAP_ENTRY _messageEntries[]; +protected: + static const AFX_MSGMAP messageMap; + virtual const AFX_MSGMAP* GetMessageMap() const; +}; + +CMainWindow :: CMainWindow() +{ +} +void CMainWindow :: OnPaint() +{ + fail = 0; +} + +void CMainWindow :: callProc() +{ + const AFX_MSGMAP* pMessageMap; + const AFX_MSGMAP_ENTRY *lpEntry; + + pMessageMap = GetMessageMap(); + lpEntry = pMessageMap->lpEntries; + + if( lpEntry->nMessage == 100) { + (this->*lpEntry->pfn)(); + } +} + +const AFX_MSGMAP* CMainWindow ::GetMessageMap() const { + return & CMainWindow ::messageMap; +} +const AFX_MSGMAP CMainWindow ::messageMap = { + & CFrameWnd ::messageMap, & CMainWindow ::_messageEntries[0] + }; +AFX_MSGMAP_ENTRY CMainWindow ::_messageEntries[] = { + { 100, (AFX_PMSG)(AFX_PMSGW)(void (CWnd::*)(void))&CMainWindow::OnPaint }, + {0, (AFX_PMSG)0 } +}; + +int main( int argc, char **argv) { + CMainWindow myWindow; + + myWindow.callProc(); + return fail; +}
p8155.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3764.C =================================================================== --- p3764.C (nonexistent) +++ p3764.C (revision 816) @@ -0,0 +1,25 @@ +// { dg-do assemble } +// prms-id: 3764 + +class Menu; +class MenuItem; + +class MenuAction { +public: + virtual void execute (Menu& menu, MenuItem& menuItem) = 0; +protected: + MenuAction () {} +}; + +class Test { + class MenuCBA : public MenuAction { + public: + typedef void (Test::* MenuCBA_Member) (Menu& menu, MenuItem& menuItem) ; + MenuCBA(Test& instance, MenuCBA_Member member) + : _instance(&instance), _member(member) { } + void execute(Menu& menu, MenuItem& menuItem); + private: + MenuCBA_Member _member; + Test *_instance; + }; +};
p3764.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: misc8.C =================================================================== --- misc8.C (nonexistent) +++ misc8.C (revision 816) @@ -0,0 +1,5 @@ +// { dg-do assemble } +// GROUPS passed vtable +class T { public: virtual ~T() {} }; +template class X : public virtual T {}; +int main() { X x; }
misc8.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: init2.C =================================================================== --- init2.C (nonexistent) +++ init2.C (revision 816) @@ -0,0 +1,9 @@ +// { dg-do assemble } + +struct Foo { + Foo (int); +}; + +int bar (Foo); + +int x = bar (3);
init2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p9706.C =================================================================== --- p9706.C (nonexistent) +++ p9706.C (revision 816) @@ -0,0 +1,37 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } +// prms-id: 9706 + +#include + +int count, acount; + +void *operator new(size_t sz) { ++count; return malloc (sz); } +void operator delete(void *p) throw() { --count; free (p); } + +class A { +public: + A() { ++acount; } + A(const A&) { ++acount; } + ~A() { --acount; } +}; + +int main() { + int i; + + // The standard library may have called new and/or delete during + // startup, so we have to reset the counter here. + count = 0; + + for( i = 0; i < 10; i++ ) { + try { + throw A(); + } + catch (A& a) { + } + } + if (acount) + return 1; + if (count) + return 2; +}
p9706.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: visibility-1.C =================================================================== --- visibility-1.C (nonexistent) +++ visibility-1.C (revision 816) @@ -0,0 +1,22 @@ +/* Test visibility attribute on template member function + instantiations. */ + +/* { dg-do compile } */ +/* { dg-options "-fvisibility=hidden" } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-not-hidden "_ZN7myClassIiE3maxEii" } } */ + +#define EXPORT __attribute__((visibility("default"))) + +template +class EXPORT myClass { +public: + T max (T t1, T t2); +}; + +template +T myClass::max (T t1, T t2) { + return (t1 > t2 ? t1 : t2); +} + +template class myClass;
visibility-1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net11.C =================================================================== --- net11.C (nonexistent) +++ net11.C (revision 816) @@ -0,0 +1,16 @@ +// { dg-do assemble } +// { dg-options "-pedantic-errors" } + +struct Foo { + char *p; + const char *q; + void m() const; +}; + +void other(char &x); + +void +Foo::m() const +{ + other(*p); // this is legal +}
net11.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: parse1.C =================================================================== --- parse1.C (nonexistent) +++ parse1.C (revision 816) @@ -0,0 +1,7 @@ +// { dg-do assemble } + +enum { name1 }; +struct name0 { }; +struct name1 { }; +struct derived1 : public name1 { }; +struct derived2 : public name0, public name1 { };
parse1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p7868.C =================================================================== --- p7868.C (nonexistent) +++ p7868.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// prms-id: 7868 + +struct DIAGTYP { +}; +struct DIAGTYP1 { + struct DIAGTYP; // { dg-error "" } forward declaration + void bar() { new struct DIAGTYP; } // { dg-error "" } undefined + void foo() { new struct DIAGTYP1; } +}; + +int main () { + struct DIAGTYP; // { dg-error "" } forward declaration + struct DIAGTYP *lerror_desc; + lerror_desc= new struct DIAGTYP; // { dg-error "" } undefined +} + +void foo () { + struct DIAGTYP *lerror_desc; + lerror_desc= new struct DIAGTYP; +}
p7868.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net36.C =================================================================== --- net36.C (nonexistent) +++ net36.C (revision 816) @@ -0,0 +1,19 @@ +// { dg-do assemble } + +class X; + +class A { +public: + void handlerFn(X*); +}; + +typedef void (A::*handler) (X*); + +class B { +public: + void setHandler(handler); +}; + +void f(B* b) { + b->setHandler(A::handlerFn); // { dg-error "" } +}
net36.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net19.C =================================================================== --- net19.C (nonexistent) +++ net19.C (revision 816) @@ -0,0 +1,20 @@ +// { dg-do assemble } +// Test to make sure & works in c++ + +struct FILE { + int _flags; +}; + +extern struct _fake_filebuf __std_filebuf_2; + +class Value { + int width; +public: + Value(); + friend Value operator&( __const Value&, __const Value&); +}; + +FILE* Foo () +{ + return ((FILE*)&__std_filebuf_2); +}
net19.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh32.C =================================================================== --- eh32.C (nonexistent) +++ eh32.C (revision 816) @@ -0,0 +1,20 @@ +// { dg-do assemble } +// { dg-options "-fexceptions" } + +class Base { +public: + virtual ~Base() throw(); +}; + +Base::~Base() throw() +{ +} + +class Foo : public Base { +public: + virtual ~Foo() throw(); +}; + +Foo::~Foo() throw() +{ +}
eh32.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p658.C =================================================================== --- p658.C (nonexistent) +++ p658.C (revision 816) @@ -0,0 +1,103 @@ +// { dg-do run } +// prms-id: 658 + +#include +#include + +/* We may not find the libg++ . */ +#ifndef FALSE +#define FALSE false +#endif +#ifndef TRUE +#define TRUE true +#endif + +class Object { +public: + Object(); + Object(const Object&); + ~Object(); + + void OK() const; +private: + bool _destructed; +}; + +class Char: public Object { +public: + Char(); + Char(char); + Char(const Char&); + ~Char(); + + operator char () const; +private: + char _c; +}; + +int main() +{ + Char r, s; + + r = Char('r'); + s = Char('s'); +} + +// +// Object stuff +// +Object::Object(): +_destructed(FALSE) +{} + +Object::Object(const Object& other): +_destructed(FALSE) +{ + other.OK(); +} + +Object::~Object() +{ + OK(); + _destructed = TRUE; +} + +void +Object::OK() const +{ + if (_destructed) { + std::cerr << "FAILURE - reference was made to a destructed object\n"; + std::abort(); + } +} + +// +// Char stuff +// + +Char::Char(): +Object(), +_c('a') +{ } + +Char::Char(char c): +Object(), +_c(c) +{ } + +Char::Char(const Char& other): +Object(other), +_c(other._c) +{ } + +Char::~Char() +{ + OK(); +} + +Char::operator char () const +{ + return _c; +} + +
p658.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh15.C =================================================================== --- eh15.C (nonexistent) +++ eh15.C (revision 816) @@ -0,0 +1,6 @@ +// { dg-do assemble } +// { dg-options "-fexceptions" } + +struct A { + A() throw (int); +};
eh15.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns3.C =================================================================== --- ns3.C (nonexistent) +++ ns3.C (revision 816) @@ -0,0 +1,5 @@ +// { dg-do assemble } +int i; // { dg-error "" } + +namespace i { // { dg-error "" } +}
ns3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: for2.C =================================================================== --- for2.C (nonexistent) +++ for2.C (revision 816) @@ -0,0 +1,19 @@ +// { dg-do assemble } + +void foo() { + for (class C {};;) + ; + C c; // { dg-error "" } +} + +void bar() { + for (enum E {num};;) + ; + E e; // { dg-error "" } +} + +void bee () { + int i = 0; + for (int fun() = 0; i != 2; ++i) { // { dg-error "" } + } +}
for2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh57.C =================================================================== --- eh57.C (nonexistent) +++ eh57.C (revision 816) @@ -0,0 +1,18 @@ +// { dg-do assemble } +// { dg-options "-fno-exceptions" } + +class Calendar_Time { +public: + ~Calendar_Time (); + int operator <= (const Calendar_Time& t) const; +}; + +class Temporal_Model_Interval { +public: + Calendar_Time start_time (); +}; + +int intersects_p (Temporal_Model_Interval* i1, Temporal_Model_Interval* i2) { + return ((i1->start_time() <= i2->start_time()) + || (i1->start_time() <= i2->start_time())); +}
eh57.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p10769b.C =================================================================== --- p10769b.C (nonexistent) +++ p10769b.C (revision 816) @@ -0,0 +1,26 @@ +// { dg-do assemble } +// { dg-options "" } +// prms-id: 10769 + +#define PMF2PF(PMF) ((void (*)())(PMF)) + +class A { +public: + void f1a() { } + void main(); +} a; + +class B { +public: + void bf1() { } +} b; + +void A::main() { + void (B::*mPtrB)(B*); + (*(void (*)(A*))PMF2PF(mPtrB))(&b); // { dg-error "" } +} + +int main() { + void (A::*mPtr)() = &A::f1a; + (*(void (*)(A*))PMF2PF(mPtr))(&a); // { dg-error "" } +}
p10769b.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pmf7.C =================================================================== --- pmf7.C (nonexistent) +++ pmf7.C (revision 816) @@ -0,0 +1,30 @@ +// { dg-do run } +class A; +typedef int (A::*f_ptr) (void); + +class B { +public: + B() {}; ~B() {}; + B& dummy(f_ptr cb) { return *this; }; +}; + +template SP& call_dummy(SP* sp, CB cb) { + sp->dummy(cb); + return *sp; +} + +class A { +public: + A() {}; ~A() {}; + int ok() { return 0; }; + A& call_it(B* s) { + call_dummy(s, &A::ok); + return *this; + }; +}; + +int main() { + A a; B b; + a.call_it(&b); + return 0; +}
pmf7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p6004.C =================================================================== --- p6004.C (nonexistent) +++ p6004.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do run } +// { dg-options "" } +// prms-id: 6004 + +class A { +public: + static int foo() asm("_my_routine"); +}; + +int bar1() asm("foo__1A"); +int bar2() asm("_foo__1A"); +int bar3() asm("__foo__1A"); +int bar1() { return 45; } +int bar2() { return 44; } +int bar3() { return 43; } + +int A::foo() { return 42; } + +main() { + return A::foo() - 42; +}
p6004.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p5611.C =================================================================== --- p5611.C (nonexistent) +++ p5611.C (revision 816) @@ -0,0 +1,12 @@ +// { dg-do run } +// prms-id: 5611 + +int main(void) +{ + struct B + { + virtual void b1() { }; + }; + + return 0; +}
p5611.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: s24939.C =================================================================== --- s24939.C (nonexistent) +++ s24939.C (revision 816) @@ -0,0 +1,13 @@ +// { dg-do assemble } + +class A; + +class B { +public: + B(); +private: + A a; // { dg-error "" } +}; + +class A { }; +B::B() { }
s24939.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net7.C =================================================================== --- net7.C (nonexistent) +++ net7.C (revision 816) @@ -0,0 +1,7 @@ +// { dg-do assemble } +// { dg-options "" } + +// This should compile. + +int foo (signed char *); +int foo (char *);
net7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p8620.C =================================================================== --- p8620.C (nonexistent) +++ p8620.C (revision 816) @@ -0,0 +1,14 @@ +// { dg-do assemble } +// prms-id: 8620 + +struct S { + long l; +}; + +typedef unsigned long l; + +void f() { + S* p; + if (p->l < 0) + return; +}
p8620.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p2806.C =================================================================== --- p2806.C (nonexistent) +++ p2806.C (revision 816) @@ -0,0 +1,20 @@ +// { dg-do assemble } +// GROUPS passed +template +class List +{ + public: + List(); + void f() const; +}; + +template +void List::f() const +{ +} + +void func() +{ + List list; + list.f(); +}
p2806.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3524b.C =================================================================== --- p3524b.C (nonexistent) +++ p3524b.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// Make sure we can cast to a templated type, that requires a conversion by +// constructor, from a derived type to a base type. + +// prms-id: 3524 + +template +struct ccPair { + ccPair () { } +}; + +template +struct ccO : ccPair { + ccO () { } +}; + +void foo () +{ + ccO r; + (ccPair)r; +}
p3524b.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4068.C =================================================================== --- p4068.C (nonexistent) +++ p4068.C (revision 816) @@ -0,0 +1,23 @@ +// { dg-do run } +// prms-id: 4068 + +struct A { + A(); + typedef void (A::*F)(); + void d(); + void foo() { } + F& f() { return f_; } + F f_; +}; + +A::A() : f_(&A::foo) { +} + +void A::d() { + (this->*(f()))(); +} + +int main() { + A a; + a.d(); +}
p4068.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh6.C =================================================================== --- eh6.C (nonexistent) +++ eh6.C (revision 816) @@ -0,0 +1,19 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +extern "C" int printf(const char *, ...); + +void main1() { + throw 1; +} + + +int main() { + try { + main1(); + } catch (...) { + printf("Unwind works!\n"); + return 0; + } + return 1; +}
eh6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3538b.C =================================================================== --- p3538b.C (nonexistent) +++ p3538b.C (revision 816) @@ -0,0 +1,35 @@ +// { dg-do assemble } +// prms-id: 3538 + +// This tests for an ambiguous conversion of the this pointer (going +// down to DECL_CONTEXT of a FUNCTION_DECL. + +class ccObjectInfo +{ +public: + virtual const ccObjectInfo& repInvariant (int); +}; + +template +class ccHandle : public ccObjectInfo +{ +protected: + T* p; +public: + virtual const ccObjectInfo& repInvariant (int); +}; + +template +const ccObjectInfo& ccHandle::repInvariant (int) +{ return p->repInvariant(1); } + +class ccHandleBase : public ccObjectInfo +{}; + +class cc_CircleHdl : public virtual ccHandleBase, public ccObjectInfo +{ // { dg-warning "" } +public: + virtual const ccObjectInfo& repInvariant (int); +}; + +class ccCircleHdl : public ccHandle {};
p3538b.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: enum1.C =================================================================== --- enum1.C (nonexistent) +++ enum1.C (revision 816) @@ -0,0 +1,11 @@ +// { dg-do assemble } +// Warn if a enum cannot fit into a small bit-field. + +enum TypeKind { ATK, BTK, CTK, DTK } ; + +struct Type { + enum TypeKind kind : 1; // { dg-warning "" } + void setBTK(); +}; + +void Type::setBTK() { kind = DTK; }
enum1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p8483.C =================================================================== --- p8483.C (nonexistent) +++ p8483.C (revision 816) @@ -0,0 +1,36 @@ +// { dg-do run } +// prms-id: 8483 + +int count; + +class A { +public: + A() { ++count; } + ~A() { } +}; + +class B { +private: + A b[2]; +}; + +class C { +public: +private: + A c[2][2]; +}; + +class D { +public: +private: + A d[2][2][2]; +}; + +int main() { + { A a; } + { B b; } + { C c; } + { D d; } + if (count != 15) + return 1; +}
p8483.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mangle3.C =================================================================== --- mangle3.C (nonexistent) +++ mangle3.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do run } +struct ZZ { + int p; +}; + + +template +struct YY { + ZZ qq; + YY() { } +}; + +int main() { + YY<&ZZ::p> ww; +}
mangle3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p6927.C =================================================================== --- p6927.C (nonexistent) +++ p6927.C (revision 816) @@ -0,0 +1,17 @@ +// { dg-do run } +// prms-id: 6927 + +class Object { +public: + Object(); + int Value; +}; + +Object::Object() : Value(-1) { } + +Object *pArr = new Object[2]; + +int main() { + if (pArr[0].Value != -1 || pArr[1].Value != -1) + return 1; +}
p6927.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p5793.C =================================================================== --- p5793.C (nonexistent) +++ p5793.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// prms-id: 5793 + +class temp_string { + public: + temp_string (const int); + temp_string (const char * const); +}; + +class Range { + public: + Range ( const int); + operator int () const ; +}; + +int operator == (const int, temp_string ); + +void CheckArrayConstraints(void) { + if (Range(0L) == 0L) + ; +}
p5793.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net20.C =================================================================== --- net20.C (nonexistent) +++ net20.C (revision 816) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// A pointer to member function test case. + +struct X +{ +}; + +void (X::* fee ())() +{ + lab: goto lab; + return 0; +}
net20.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dyncast5.C =================================================================== --- dyncast5.C (nonexistent) +++ dyncast5.C (revision 816) @@ -0,0 +1,72 @@ +// { dg-do run } +#include + +void *p; +int fail; + +class HeapTracked { +public: + virtual ~HeapTracked() = 0; + void *operator new(size_t size); + void operator delete(void *ptr); + static bool isObjectAllocation(const HeapTracked *ptr); +}; + +HeapTracked::~HeapTracked(){} +void * HeapTracked::operator new(size_t size) +{ + void * memPtr = ::operator new(size); + p = memPtr; + return memPtr; +} + +void HeapTracked::operator delete(void *ptr) +{ + if (p != ptr) + fail = 1; + ::operator delete(ptr); +} + +bool HeapTracked::isObjectAllocation(const HeapTracked *ptr) +{ + if (p != const_cast(dynamic_cast(ptr))) + fail = 1; + return false; +} + +class Mumble1: public virtual HeapTracked { + double d; +public: + virtual ~Mumble1(){} +}; + +class Mumble2: public virtual HeapTracked { + double d; +public: + virtual ~Mumble2(){} +}; + +class Foo: virtual public HeapTracked, + virtual public Mumble1, + virtual public Mumble2 { +public: + ~Foo(){} +}; + +int main() +{ + Foo *pf = new Foo; + pf->isObjectAllocation(pf); + + Mumble1 *pm1 = pf; + pm1->isObjectAllocation(pm1); + + Mumble2 *pm2 = pf; + pm2->isObjectAllocation(pm2); + + // delete pf; + // delete pm1; + delete pm2; + + return fail; +}
dyncast5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p10416.C =================================================================== --- p10416.C (nonexistent) +++ p10416.C (revision 816) @@ -0,0 +1,8 @@ +// { dg-do assemble { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } +// prms-id: 10416 + +class not_ok { +public: + void f() throw(int) { } +};
p10416.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: warn8.C =================================================================== --- warn8.C (nonexistent) +++ warn8.C (revision 816) @@ -0,0 +1,20 @@ +// { dg-do assemble } +// { dg-options "-Waddress" } + +struct foo { + bool test(); +}; +bool func(); + +void test() { + foo A; + bool (foo::* pmf)() = &foo::test; + bool (*pf)() = func; + + if (A.test) ; // { dg-error "" } + if (func) ; // { dg-warning "" } + if (bool(A.test)) ; // { dg-error "" } + if (bool(func)) ; // { dg-warning "" } + if (pmf) ; + if (pf) ; +}
warn8.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net45.C =================================================================== --- net45.C (nonexistent) +++ net45.C (revision 816) @@ -0,0 +1,19 @@ +// { dg-do assemble } + +template +struct pair { + T1 first; + T2 second; + pair(const T1& a, const T2& b) : first(a), second(b) {} +}; + +struct myint { + myint() { + } + myint(const myint& mi) { + } + myint& operator=(const myint& mi) { return *this; } +}; + +extern pair a; +pair b(a);
net45.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net28.C =================================================================== --- net28.C (nonexistent) +++ net28.C (revision 816) @@ -0,0 +1,28 @@ +// { dg-do assemble } +// From reinhard@ifki50.informatik.fh-muenchen.de against gcc 2.5.0. +// shows an InterViews problem on RS6000 and i386. Doesn't happen on +// SPARC. + +// From fbrowser.c. + + +class test { +}; + + +typedef int ( test ::* test2)(int fd); + +class ivFileBrowserImpl_IOCallback +{ + public: + + int inputReady(int fd); + test * _obj; + test2 _input; +}; + + +int ivFileBrowserImpl_IOCallback ::inputReady(int fd) +{ + return (_obj->*_input)(fd); +}
net28.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh41.C =================================================================== --- eh41.C (nonexistent) +++ eh41.C (revision 816) @@ -0,0 +1,29 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +int fail = 0; + +struct A { + A () { a = 'a'; b = 'b'; c = 'c'; } + ~ A () { + if ( a != 'a' ) fail = 1; + if ( b != 'b' ) fail = 1; + if ( c != 'c' ) fail = 1; + } + char a, b, c; +}; + +void some_init () { throw 1; } + +struct C : A { + C () { some_init (); } +}; + +int main () { + try { + C c; + } catch (int i) { + return 0; + } + return 1; +}
eh41.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh24.C =================================================================== --- eh24.C (nonexistent) +++ eh24.C (revision 816) @@ -0,0 +1,33 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +int fail = 0; + +struct A { + int ok; + A() { + ok = 1; + } + ~A() { + if (! ok) + fail = 1; + ok = 0; + } +}; + +main() { + try { + try { + A a; + throw 1.0; + } catch (double i) { + A a1; + throw 1; // make sure both a1 and a2 are not destroyed when we throw! + } catch (int i) { + A a2; + throw 1.0; + } + } catch (int i) { + } + return fail; +}
eh24.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: rtti3.C =================================================================== --- rtti3.C (nonexistent) +++ rtti3.C (revision 816) @@ -0,0 +1,24 @@ +// { dg-do run } +class base { +public: + virtual ~base() {} + virtual void m1() = 0; + virtual void m2() = 0; +}; + +class intermediate : public virtual base { +public: + virtual ~intermediate() {} + virtual void m1() {} + virtual void m2() {} +}; + +class derived : public intermediate { +public: + virtual int IwantedThisMethod() { return 0; } + virtual int ButIgotThisOne() { return 1; } +}; + +int main() { + return derived().IwantedThisMethod(); +}
rtti3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: debug1.C =================================================================== --- debug1.C (nonexistent) +++ debug1.C (revision 816) @@ -0,0 +1,14 @@ +// { dg-do assemble } +// { dg-options "-g -O -fkeep-inline-functions" } + +class c { +public: + ~c () { }; +}; + +int +foo (const c& lhs) +{ + c str (lhs); + return 0; +}
debug1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh49.C =================================================================== --- eh49.C (nonexistent) +++ eh49.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions -O9" } + +void main1() { + throw 1; +} + +int main() { + try { + main1(); + } catch (...) { + return 0; + } + return 1; +}
eh49.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: virt6.C =================================================================== --- virt6.C (nonexistent) +++ virt6.C (revision 816) @@ -0,0 +1,40 @@ +// { dg-do run } +// This testcase ensures that we can build vtable names for complex MI +// classes. + +class C_A { +public: + virtual int foo(void *) { return 0; } +} a; + +class C_B : public C_A { +} b; + +class C_C : public C_A { +} c; + +class C_D : public C_A { +} d; + +class C_E : public C_C, public C_B { +public: + virtual int foo(void *) { return 0; } +} e; + +class C_F : public C_D, public C_B { +public: + virtual int foo(void *) { return 0; } +} f; + +class C_G : public C_A { +public: + virtual int foo(void *) { return 0; } +} g; + +class C_H : public C_G, public C_E, public C_F { +public: + virtual int foo(void *) { return 0; } +} h; + +int main() { +}
virt6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: misc1.C =================================================================== --- misc1.C (nonexistent) +++ misc1.C (revision 816) @@ -0,0 +1,54 @@ +// { dg-do run } +// GROUPS passed construct-destruct +/* g++ constructs j 13 times, and destructs it once. */ + +extern "C" { + int printf (const char *, ...); + void exit(int); +} + +void foo() { +} + +class C { + int val; + public: + static int count; + C(int ii) { + val = ii; + ++count; + printf("up\n"); + } + ~C() { + --count; + printf("down\n"); + } + int operator ++() { + return ++val; + } + operator int() { + return val; + } +}; + +int C::count = 0; + +void bar() { + for (int ii=0; ii<13; ++ii) + for (C j=1; j<9; ++j) + foo(); +} + +int main() { + bar(); + if (C::count) + { + printf("FAIL\n"); + exit(1); + } + else + { + printf("PASS\n"); + } + return 0; +}
misc1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns11.C =================================================================== --- ns11.C (nonexistent) +++ ns11.C (revision 816) @@ -0,0 +1,19 @@ +// { dg-do run } +class Foo { +}; + +namespace A { + namespace Foo { + int bar() { + return 0; + } + } + + int mymain() { + return Foo::bar(); + } +} + +int main() { + return A::mymain(); +}
ns11.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p2793.C =================================================================== --- p2793.C (nonexistent) +++ p2793.C (revision 816) @@ -0,0 +1,6 @@ +// { dg-do assemble } +// prms-id: 2793 + +void f(char&) { // { dg-error "" } referenced by error below + f('c'); // { dg-error "" } +}
p2793.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: misc9.C =================================================================== --- misc9.C (nonexistent) +++ misc9.C (revision 816) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// { dg-options "-Wall -pedantic" } +// GROUPS passed qualifiers +class bee { + public: + int bee::bar; // { dg-warning "" } there is an extra bee:: here +}; + +class foo { + public: + int bee::bar; // { dg-error "" } you cannot do this + int me(); +};
misc9.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p6578.C =================================================================== --- p6578.C (nonexistent) +++ p6578.C (revision 816) @@ -0,0 +1,8 @@ +// { dg-do assemble } +// prms-id: 6578 + +struct A { + operator int (); +}; + +int i = A();
p6578.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net12.C =================================================================== --- net12.C (nonexistent) +++ net12.C (revision 816) @@ -0,0 +1,16 @@ +// { dg-do assemble } +// { dg-options "-pedantic-errors" } + +struct Foo { + char *p; + const char *q; + void m() const; +}; + +void other(char &x); // { dg-error "" } reference below + +void +Foo::m() const +{ + other(*q); // { dg-error "" } this is bad +}
net12.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p10148.C =================================================================== --- p10148.C (nonexistent) +++ p10148.C (revision 816) @@ -0,0 +1,35 @@ +// { dg-do run } +// { dg-options "" } +// prms-id: 10148 + +int fail = 1; +void ok() { fail = 0; } + +class TC { + int s_; +}; + +class TIRD { + public: + void (*itc)(); + TIRD() { itc = ok; } +}; + +class TCCB : public TC, public TIRD { +}; + +class TCRCB : public TCCB { +public: + virtual void eat (); +}; + +void TCRCB::eat () { + void *vp = (void *)((TIRD*)this)->itc; + this->itc(); +} + +int main() { + TCRCB a; + a.eat(); + return fail; +}
p10148.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: misc11.C =================================================================== --- misc11.C (nonexistent) +++ misc11.C (revision 816) @@ -0,0 +1,4 @@ +// { dg-do assemble } +// GROUPS passed pt coredump +template class A; +void f () { A *a; }
misc11.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p438.C =================================================================== --- p438.C (nonexistent) +++ p438.C (revision 816) @@ -0,0 +1,23 @@ +// { dg-do assemble } +// prms-id: 438 + +class D; + +class C +{ + public: + void test() const; +}; + +class D +{ + public: + void a(C& b); // { dg-error "" } referenced below +}; + +void C::test() const +{ + D d; + + d.a(*this); // { dg-error "" } *this is const, so should get error +}
p438.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net37.C =================================================================== --- net37.C (nonexistent) +++ net37.C (revision 816) @@ -0,0 +1,40 @@ +// { dg-do run } +class B { +public: + int bi; + void bProc ( void ) { bi = 39; } + }; + +class D : public B { +public: + int di; + void dProc (void ){ di = 42; } + }; + +typedef void (B::*BPROC)(void); +typedef void (D::*DPROC)(void); + +union AFX_PMSG { +public: + + AFX_PMSG () {}; + AFX_PMSG ( BPROC bpr ) { bfn = bpr ; } + + operator BPROC() { return bfn; } + + BPROC bfn; + DPROC dfn; +}; + + +int main(int argc, char *argv[]) { + B b; + D d; + + BPROC bpr = &B::bProc; + AFX_PMSG pmsg(bpr); + + BPROC ppr = pmsg; + + return 0; +}
net37.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh50.C =================================================================== --- eh50.C (nonexistent) +++ eh50.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } } +// { dg-options "-fexceptions" } + +#include + +void my_unexpected() { + throw 42; +} + +template void foo(T) throw (int) { throw "Hi"; } + +main() { + std::set_unexpected (my_unexpected); + try { + foo(1); + } catch (int i) { + if (i == 42) + return 0; + } + return 1; +}
eh50.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh33.C =================================================================== --- eh33.C (nonexistent) +++ eh33.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } } +// { dg-options "-fexceptions" } + +#include + +void my_unexpected() { + throw 42; +} + +void foo() throw (int) { throw "Hi"; } + +int main() { + std::set_unexpected (my_unexpected); + try { + foo(); + } catch (int i) { + if (i == 42) + return 0; + } + return 1; +}
eh33.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: explicit1.C =================================================================== --- explicit1.C (nonexistent) +++ explicit1.C (revision 816) @@ -0,0 +1,16 @@ +// { dg-do assemble } +struct A1 { + explicit A1(int) { } +} a1(1); + +struct A { + explicit A(int); +} a(1); + +A::A(int) { +} + +void foo(A a) { + foo(a); + foo(1); // { dg-error "" } not allowed +}
explicit1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh16.C =================================================================== --- eh16.C (nonexistent) +++ eh16.C (revision 816) @@ -0,0 +1,26 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +int err = 1; + +struct A { + ~A() { + --err; + } +}; + +struct B { + A a; + B() { + throw 1; + } +}; + +main() { + try { + B b; + } catch (...) { + return err; + } + return 1; +}
eh16.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns4.C =================================================================== --- ns4.C (nonexistent) +++ ns4.C (revision 816) @@ -0,0 +1,6 @@ +// { dg-do assemble } + +namespace i { +} +namespace i { +}
ns4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh58.C =================================================================== --- eh58.C (nonexistent) +++ eh58.C (revision 816) @@ -0,0 +1,18 @@ +// { dg-do assemble } +// { dg-options "-fexceptions" } + +struct C { + bool mem; + ~C(); +}; + +C genTemp(); + +int foo_notok(int arg) { + switch (arg) { + case 0: + return genTemp().mem; + default: + return 3; + } +}
eh58.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: for3.C =================================================================== --- for3.C (nonexistent) +++ for3.C (revision 816) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// { dg-options "-Wshadow" } + +int +main(int i) { // { dg-warning "" } shadowed decl + for(int i=1; i < 3; i++); // { dg-warning "" } declaration of + for(int i=1; i < 3; i++); // { dg-warning "" } declaration of + for(int j=1; j < 3; j++); + for(int j=1; j < 3; j++); +}
for3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pmf8.C =================================================================== --- pmf8.C (nonexistent) +++ pmf8.C (revision 816) @@ -0,0 +1,32 @@ +// { dg-do run } +int fail; + +class A *ptr_a; + +class A { +public: + char space1[24]; + virtual void foo() { + if (this != ptr_a) + fail = 1; + } +}; + +class Space { + char space2[36]; +}; + +class B : public Space, public A { +} b; + +void (B::*pmf1)() = &A::foo; +void (A::*pmf2)() = &A::foo; + +int main() { + ptr_a = &b; + (b .* (void (B::*) ()) &A::foo) (); + (b .* pmf1) (); + (b .* pmf2) (); + (b .* &A::foo) (); + return fail; +}
pmf8.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4623.C =================================================================== --- p4623.C (nonexistent) +++ p4623.C (revision 816) @@ -0,0 +1,36 @@ +// { dg-do run } +// prms-id: 4623 + +class base { +public: + int b_data; + base( int i=0 ) { b_data = i; } + void b_print() { } +}; + +class base1: virtual public base { +public: + int b1_data; + base1( int i = 0 ) { b1_data = i; b_data++; } + void b1_print() { } +}; + +class base2: virtual public base { +public: + int b2_data; + base2( int i = 0 ) { b2_data = i; b_data++; } + void b2_print() { } +}; + +class base3: public base {}; + +class derived: public base3, public base1, public base2 { +public: + int d_data; + derived( int i ) { d_data = i; ((base3 *)this)->b_data++; } + void d_print() { } +}; + +int main() { + derived d(1); d.d_print(); return 0; +}
p4623.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3570.C =================================================================== --- p3570.C (nonexistent) +++ p3570.C (revision 816) @@ -0,0 +1,30 @@ +// { dg-do run } +// prms-id: 3570 + +extern "C" int printf(const char *, ...); + +struct A { + void print() {printf("A");}; +}; + +struct B : A { + typedef A superB; + void print() {superB::print(); printf("B");}; +}; + +struct C : B { + typedef B superC; + void print() {superC::print(); printf("C");}; +}; + +int main () +{ + A a; + B b; + C c; + + a.print(); printf("\n"); + b.print(); printf("\n"); + c.print(); printf("\n"); + return 0; +}
p3570.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net8.C =================================================================== --- net8.C (nonexistent) +++ net8.C (revision 816) @@ -0,0 +1,32 @@ +// { dg-do assemble } +// { dg-options "-pedantic-errors" } + +class Base { +public: + int foo; +}; + +class Derived : public Base { +public: + int bar; +}; + +void func(Base&); // { dg-error "passing argument 1" } + +void func2(const Derived& d) { + func(d); // { dg-error "invalid initialization" } +} + +void +foo (int& a) // { dg-error "in passing argument 1" } +{ +} + +int main () +{ + int b; + const int*const a = &b; + *a = 10; // { dg-error "read-only location" } + foo (*a); // { dg-error "invalid initialization" } + return 0; +}
net8.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3524c.C =================================================================== --- p3524c.C (nonexistent) +++ p3524c.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Make sure we can cast to a templated type, that requires a conversion by +// constructor, from a non-aggregate type. + +// prms-id: 3524 + +template +struct ccPair { + ccPair (int i) { } +}; + +void foo () +{ + (ccPair)1; +}
p3524c.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh7.C =================================================================== --- eh7.C (nonexistent) +++ eh7.C (revision 816) @@ -0,0 +1,7 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +main() { + if (0) + throw 1 | 2; +}
eh7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p5718.C =================================================================== --- p5718.C (nonexistent) +++ p5718.C (revision 816) @@ -0,0 +1,38 @@ +// { dg-do run } +// prms-id: 5718 + +class Base { + int i; +public: + Base() { i = 42; }; +}; + + +class Mixin { + int j; +public: + Mixin() { j = 42; } +}; + + +class Derived : public Base, public Mixin { +public: + Derived() { }; + Derived & operator=(Mixin & m) { return *this; }; +}; + + +void +testFunct(Derived * arg) { + Mixin temp; + + (Mixin &)(*arg) = temp; // { dg-bogus "" } +} + + +int +main(int argc, char *argv[]) { + Derived temp; + + testFunct(&temp); +}
p5718.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p8825.C =================================================================== --- p8825.C (nonexistent) +++ p8825.C (revision 816) @@ -0,0 +1,14 @@ +// { dg-do assemble } +// prms-id: 8825 + +class A { + typedef A x; +}; + +class B { + typedef B x; +}; + +class C : public A, public B { + typedef C x; +};
p8825.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: warn1.C =================================================================== --- warn1.C (nonexistent) +++ warn1.C (revision 816) @@ -0,0 +1,14 @@ +// { dg-do assemble } +// { dg-options "-Wall" } + +typedef char * charptr; +typedef __SIZE_TYPE__ size_t; +char c[]={'A','B','C','D'}; +int i=size_t(&c); +int *pp=&i; +void foo() { } +int main() +{ + charptr(*pp)++; // { dg-warning "" } + return 0; +}
warn1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net21.C =================================================================== --- net21.C (nonexistent) +++ net21.C (revision 816) @@ -0,0 +1,60 @@ +// { dg-do run } +// Make sure we can initialize complex (MI ambiguous) vtables. + +extern "C" int printf(const char *, ...); + +struct a +{ + virtual void f() = 0; +}; + +struct b +{ + virtual void g() { }; +}; + +struct c: public a, public b +{ + virtual void f(); + virtual void g(); +}; + +void c::f() +{ + printf("c::f()\n"); +} + +void c::g() +{ + printf("c::g()\n"); +} + +struct e: public b +{ +}; + +struct h +{ +}; + +struct d: public c, public e, public h +{ + virtual void f(); + virtual void g(); +}; +void d::f() +{ + printf("d::f()\n"); +} + +void d::g() +{ + printf("d::g()\n"); +} + +int main(int argc, char* argv[]) +{ + a* tmp = new d; + tmp->f(); + return 0; +}
net21.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dyncast6.C =================================================================== --- dyncast6.C (nonexistent) +++ dyncast6.C (revision 816) @@ -0,0 +1,13 @@ +// { dg-do assemble } +#include + +class A { +public: + virtual void j () {} +}; + +class B : public A { }; + +void x (A& a) { + const B& b1 = dynamic_cast((const A&)a); // { dg-error "" } opps +}
dyncast6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p8786.C =================================================================== --- p8786.C (nonexistent) +++ p8786.C (revision 816) @@ -0,0 +1,24 @@ +// { dg-do assemble } +// { dg-options "-O" } +// prms-id: 8786 + +class B { +public: + ~B(); +}; + +class D : public B { +public: + D(int); +}; + +int foo() { + D t(0); + + bool h = 1; + if (h) { + D p(0); + return 0; + } + return 0; +}
p8786.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vtable1.C =================================================================== --- vtable1.C (nonexistent) +++ vtable1.C (revision 816) @@ -0,0 +1,12 @@ +// { dg-do link } +// { dg-options "-fno-implement-inlines " } +struct type { + virtual void m1(); + virtual void m2() { } +}; + +void type::m1() { } + +int main() { + type t; +}
vtable1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p11482.C =================================================================== --- p11482.C (nonexistent) +++ p11482.C (revision 816) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// prms-id: 11482 + +void *vp; + +enum E { bad, ok } e; + +void foo() { + e = (E)vp; // { dg-error "" } +}
p11482.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net46.C =================================================================== --- net46.C (nonexistent) +++ net46.C (revision 816) @@ -0,0 +1,22 @@ +// { dg-do run } +#include +#include +#include +#include + +int fail = 1; + +int in_main = 0; + +void *operator new(size_t size) throw (std::bad_alloc) { + if (!in_main) return malloc (size); + --fail; + return (void*) 0; +} + +int main() { + std::cout << ""; + in_main = 1; + new int; + return fail; +}
net46.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net29.C =================================================================== --- net29.C (nonexistent) +++ net29.C (revision 816) @@ -0,0 +1,27 @@ +// { dg-do assemble } +// This is a test case for the recent libg++ make check problem. + +class SubString { +public: + SubString(); + SubString(const SubString& x); +}; + +class String { +public: + String(); + String(const SubString& x); +}; + +int operator!=(const String& x, const SubString& y); +int operator!=(const String& x, const String& y); + +int operator!=(const SubString& x, const String& y); +int operator!=(const SubString& x, const SubString& y); + +void comparetest() +{ + String x; + SubString s; + x != s; +}
net29.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p783.C =================================================================== --- p783.C (nonexistent) +++ p783.C (revision 816) @@ -0,0 +1,16 @@ +// { dg-do run } +// prms-id: 783 + +extern "C" int printf (const char *, ...); + +class C { +public: + C() { } + ~C() { } +}; + +int main(int argc, char**argv) { + C c,d; + c = (argc&1) ? C() : d; + return 0; +}
p783.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh42.C =================================================================== --- eh42.C (nonexistent) +++ eh42.C (revision 816) @@ -0,0 +1,18 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +struct none { int i[50]; }; + +class my_ex { } a; + +none throw_it() { + throw 1; +} + +int main() { + try { + none n = throw_it(); + } catch (int ex) { + return 0; + } +}
eh42.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh25.C =================================================================== --- eh25.C (nonexistent) +++ eh25.C (revision 816) @@ -0,0 +1,31 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +#include +#include + +void my_terminate() { + exit (0); // Double faults should call terminate +} + +struct A { + A() { } + ~A() { + std::set_terminate (my_terminate); + throw 1; // This throws from EH dtor, should call my_terminate + } +}; + +main() { + try { + try { + throw 1; + } catch (int i) { + A a; // A hit on this EH dtor went to the wrong place + throw 1; + } + } catch (...) { + return 1; + } + return 1; +}
eh25.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: thunk1.C =================================================================== --- thunk1.C (nonexistent) +++ thunk1.C (revision 816) @@ -0,0 +1,18 @@ +// { dg-do assemble } + +struct C1 +{ + virtual ~C1(); +}; + +struct C2 : public virtual C1 +{ + virtual ~C2(); +}; + +struct C3 : public virtual C2 +{ + virtual ~C3(); +}; + +C3::~C3() {}
thunk1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: misc2.C =================================================================== --- misc2.C (nonexistent) +++ misc2.C (revision 816) @@ -0,0 +1,11 @@ +// { dg-do assemble } +// { dg-options "-ansi -pedantic" } +// GROUPS passed +/* -ansi -pedantic-errors should catch this. */ + +class C { + public: + extern inline int A() {// { dg-error "" } .* + return 1; + } +};
misc2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p1248.C =================================================================== --- p1248.C (nonexistent) +++ p1248.C (revision 816) @@ -0,0 +1,29 @@ +// { dg-do run } +// GROUPS passed pure-virt +extern "C" int printf (const char *, ...); +class Base { +public: + virtual ~Base() =0; +}; + +class Deranged : public Base { +public: + int value; + virtual ~Deranged(); +}; + + +Deranged::~Deranged(){} + +void foo() { + Deranged d; +} + +int main() +{ + foo(); + printf("PASS\n"); + return 0; +} + +Base::~Base () { }
p1248.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p2573.C =================================================================== --- p2573.C (nonexistent) +++ p2573.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// prms-id: 2573 + +class X { +public: + int key(); + virtual int vkey(); + char *add(); +}; + +char *X::add() { + char *f1 = (char *) &key; // { dg-error "" } + char *f2 = (char *) &vkey; // { dg-error "" } + return f1; +}
p2573.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p2394.C =================================================================== --- p2394.C (nonexistent) +++ p2394.C (revision 816) @@ -0,0 +1,37 @@ +// { dg-do run } +// prms-id: 2394 + +class Foo { + public: + int x; + int y; + Foo(int i, int j) { x = i; y = j; } +} foo(10, 11); + +class Wasted { int unsed; }; + +class Bar : Wasted, public Foo { +public: + Bar() : Foo(12, 13) { } +} bar; + +int +test0() { + int Foo::* pmi = &Foo::y; + return (int)(foo.*pmi); +} + +int +test1() { + int Foo::* pmi = &Foo::y; + return (int)(bar.*pmi); +} + +int +main() { + if (test0() != 11) + return 1; + if (test1() != 13) + return 2; + return 0; +}
p2394.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p1567.C =================================================================== --- p1567.C (nonexistent) +++ p1567.C (revision 816) @@ -0,0 +1,42 @@ +// { dg-do run } +// GROUPS passed vtable +extern "C" int printf (const char *, ...); +extern "C" void exit(int); + +class A { +public: + virtual const char* f1() { return "A::f1"; } + virtual const char* f2() { return "A::f2"; } + virtual const char* f3() { printf("FAIL\n"); exit(1); return "A::f3"; } +}; + +class B { +public: + virtual const char* f2() { return "B::f2"; } + virtual const char* f3() { return "B::f3"; } +}; + +class C: public A, public B { +public: + const char* f2() { return B::f2(); } + const char* f1() { return f2(); } + const char* f3() { return A::f3(); } +}; + +class D: public A, public B { +public: + const char* f2() { return B::f2(); } + const char* f1() { return D :: f2(); } + const char* f3() { return A::f3(); } +}; + +int main() { + C* tempC = new C; + D* tempD = new D; + A* a = tempC; + printf("calling f1 on a C gives %s\n", a->f1()); + a = tempD; + printf("calling f1 on a D gives %s\n", a->f1()); + printf("PASS\n"); + return 0; +}
p1567.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns12.C =================================================================== --- ns12.C (nonexistent) +++ ns12.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do run } +namespace { + int i = 10; + enum fish { one = 1, two = 2, red = 3, blue = 4 }; +} +extern "C" int printf (const char *, ...); +int main(void) +{ + if (i != 10) { + return 1; + } + if (one != 1) { + return 2; + } +}
ns12.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p9129.C =================================================================== --- p9129.C (nonexistent) +++ p9129.C (revision 816) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// { dg-options "-ansi -pedantic-errors" } +// prms-id: 9129 + +class Foo { +public: + int DoSomething(); +}; + +int (Foo::*pA)() = { &Foo::DoSomething }; +int (Foo::*X[1])(int) = { { &Foo::DoSomething } }; // { dg-error "" } +int (Foo::*Y[])(int) = { { &Foo::DoSomething, &Foo::DoSomething, 0 } }; // { dg-error "" }
p9129.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net30.C =================================================================== --- net30.C (nonexistent) +++ net30.C (revision 816) @@ -0,0 +1,18 @@ +// { dg-do assemble } + +class X { +public: + void x(void); +}; + +class Y : public X { +}; + +class Z : private Y { +public: + void y(void); +}; + +void Z::y(void) { + x(); // should be OK +}
net30.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net13.C =================================================================== --- net13.C (nonexistent) +++ net13.C (revision 816) @@ -0,0 +1,14 @@ +// { dg-do assemble } + +// make sure extern "C" friends work. + +extern "C" { void func(); } + +struct crash { + int i; + friend void func(); +} a; + +void func() { + a.i = 1; +}
net13.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p12306.C =================================================================== --- p12306.C (nonexistent) +++ p12306.C (revision 816) @@ -0,0 +1,76 @@ +// { dg-do run } +// prms-id: 12306 + +void *ptr1, *ptr2; +int fail = 0; + +extern "C" int printf(const char *...); + +class RWSlist { }; + +class RWSlistIterator { +public: + RWSlist *slist; + RWSlistIterator(RWSlist& s) { } + void toLast() { + if (ptr1 != (RWSlistIterator*)this) + fail = 5; + if (ptr2 != &(*this).slist) + fail = 6; + + if (0) printf("at %x %x\n", (RWSlistIterator*)this, &(*this).slist); + } +}; + +class RWCollectable { +}; + +class RWSlistCollectables : public RWSlist { +public: + RWSlistCollectables() { } + RWSlistCollectables(RWCollectable* a) { } +}; + +class RWIterator { }; + +class RWSlistCollectablesIterator : public RWIterator, public RWSlistIterator { +public: + RWSlistCollectablesIterator(RWSlistCollectables& s) : RWSlistIterator(s) { } +}; + +class Sim_Event_Manager { +public: + RWSlistCollectables scheduled_events_; + RWSlistCollectablesIterator last_posted_event_position_; + Sim_Event_Manager(); + void post_event(); +}; + +Sim_Event_Manager::Sim_Event_Manager () + :last_posted_event_position_(scheduled_events_) +{ +} + +void Sim_Event_Manager::post_event () { + ptr1 = (RWSlistIterator*)&last_posted_event_position_; + ptr2 = &((RWSlistIterator*)&last_posted_event_position_)->slist; + if (0) printf("at %x %x\n", (RWSlistIterator*)&last_posted_event_position_, + &((RWSlistIterator*)&last_posted_event_position_)->slist); + if (ptr1 != (RWSlistIterator*)&last_posted_event_position_) + fail = 1; + if (ptr2 != &((RWSlistIterator&)last_posted_event_position_).slist) + fail = 2; + if (0) printf("at %x ?%x\n", (RWSlistIterator*)&last_posted_event_position_, + &((RWSlistIterator&)last_posted_event_position_).slist); + if (ptr1 != (RWSlistIterator*)&last_posted_event_position_) + fail = 3; + if (ptr2 != &((RWSlistIterator&)last_posted_event_position_).slist) + fail = 4; + last_posted_event_position_.toLast(); +} + +int main(int argc, char **argv) { + Sim_Event_Manager foo; + foo.post_event(); + return fail; +}
p12306.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p10247.C =================================================================== --- p10247.C (nonexistent) +++ p10247.C (revision 816) @@ -0,0 +1,7 @@ +// { dg-do assemble } +// prms-id: 10247 + +class a { +public: + int operator++(int) { return operator()++ ; } // { dg-error "" } +};
p10247.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: misc12.C =================================================================== --- misc12.C (nonexistent) +++ misc12.C (revision 816) @@ -0,0 +1,8 @@ +// { dg-do assemble } +// GROUPS passed +struct A { virtual void f(); }; +struct B { virtual void f() ; }; +struct C : virtual A , virtual B { virtual void f(); }; + +/* This used to get an error because the DECL_CONTEXT was blown away. */ +void g(A *ptr) { ptr->f(); }
misc12.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net38.C =================================================================== --- net38.C (nonexistent) +++ net38.C (revision 816) @@ -0,0 +1,29 @@ +// { dg-do run } +struct A { + virtual int a () { return 0; } +}; + +struct B { + virtual int b () { return 0; } + virtual int b2 () { return 0; } +}; + +struct C : public A, public B { + virtual int a () { return 1; } + virtual int b () { return 2; } + virtual int b2 () { return 3; } +}; + +int (C::*vmpb) () = &C::b; +int (C::*vmpb2) () = &C::b2; +int (C::*vmpa) () = &C::a; + +int main () { + C c; + if ((c.*vmpa)() != 1) + return 1; + if ((c.*vmpb)() != 2) + return 1; + if ((c.*vmpb2)() != 3) + return 1; +}
net38.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p755a.C =================================================================== --- p755a.C (nonexistent) +++ p755a.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do run } +// It checks to see if you can define your own global delete operator. +// prms-id: 755 + +extern "C" void _exit(int); + +void operator delete(void *p) throw() { + _exit(0); +} + +int main () { + int* i = new int; + delete i; + return 1; +}
p755a.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh51.C =================================================================== --- eh51.C (nonexistent) +++ eh51.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } } +// { dg-options "-fexceptions" } + +#include + +void my_unexpected() { + throw 42; +} + +template void foo(T) throw (T) { throw "Hi"; } + +main() { + std::set_unexpected (my_unexpected); + try { + foo(1); + } catch (int i) { + if (i == 42) + return 0; + } + return 1; +}
eh51.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh34.C =================================================================== --- eh34.C (nonexistent) +++ eh34.C (revision 816) @@ -0,0 +1,17 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +#include +#include + +void my_unexpected() { + exit (0); +} + +void foo() throw () { throw "Hi"; } + +int main() { + std::set_unexpected (my_unexpected); + foo(); + return 1; +}
eh34.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: explicit2.C =================================================================== --- explicit2.C (nonexistent) +++ explicit2.C (revision 816) @@ -0,0 +1,24 @@ +// { dg-do assemble } + +class string { +public: + string(const char*) { } + explicit string(int size) { } +}; + +void foo(string) { } + +string bar() { + foo("hello"); // ok + foo(string(2)); // ok + foo(2); // { dg-error "" } no implicit conversion from int to string + string x = 2; // { dg-error "" } no implicit conversion from int to string + string y(2); // ok + foo((string)2); // ok + return 2; // { dg-error "" } no implicit conversion from int to string +} + +class A : string { +public: + A() : string(2) { } // ok +};
explicit2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pmf1.C =================================================================== --- pmf1.C (nonexistent) +++ pmf1.C (revision 816) @@ -0,0 +1,91 @@ +// { dg-do run } +// extern "C" printf(const char *, ...); + +class X +{ +public: + int a; + int f(int); +}; + +class Y +{ +public: + int b; + int c; + int g(int); +}; + +class MD : public X, public Y +{ +public: + int c; + int hf(int); +}; + +int MD::* pmi0 = &MD::a; +int MD::* pmi1 = &MD::b; +int MD::* pmi2 = &MD::c; + +int (MD::* pmf0)(int) = &MD::f; +int (MD::* pmf1)(int) = &MD::g; +int (MD::* pmf2)(int) = &MD::hf; + +int main() +{ + MD obj; + int fail = 0; + + obj.a = 1; + obj.b = 2; + obj.c = 3; + + obj.*pmi0 = 7; + obj.*pmi1 = 8; + obj.*pmi2 = 9; + + fail += (obj.*pmf0)(7); + fail += (obj.*pmf1)(8); + fail += (obj.*pmf2)(9); + +#if 0 + if (fail != 0) + printf ("failed %d tests\n", fail); + else + printf ("passed\n"); + + printf ("sizeof(X) = %d, sizeof(Y) = %d, sizeof(MD) = %d\n", + sizeof(X), sizeof(Y), sizeof(MD)); +#endif + return fail; +} + +int X::f(int v) +{ + if (v != a) + { +// printf ("failed in X::f, a = %d\n", a); + return 1; + } + return 0; +} + +int Y::g(int v) +{ + if (v != b) + { +// printf ("failed in Y::g, b = %d\n", b); + return 1; + } + return 0; +} + +int MD::hf(int v) +{ + if (v != c) + { +// printf ("failed in MD::hf, c = %d\n", c); + return 1; + } + return 0; +}
pmf1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh17.C =================================================================== --- eh17.C (nonexistent) +++ eh17.C (revision 816) @@ -0,0 +1,25 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +int err = 1; + +struct A { + ~A() { + --err; + } +}; + +struct B : public A { + B() { + throw 1; + } +}; + +main() { + try { + B b; + } catch (...) { + return err; + } + return 1; +}
eh17.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns5.C =================================================================== --- ns5.C (nonexistent) +++ ns5.C (revision 816) @@ -0,0 +1,6 @@ +// { dg-do assemble } +namespace A { + int i = 1; +} + +int j = i; // { dg-error "" }
ns5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net1.C =================================================================== --- net1.C (nonexistent) +++ net1.C (revision 816) @@ -0,0 +1,19 @@ +// { dg-do assemble } +// Here is a net bug + +class ivAllocation { +public: + ivAllocation(); + int x_; +}; + +class TBScrollBoxInfo { +public: + ivAllocation allocation_; +}; + +TBScrollBoxInfo* items_; + +inline TBScrollBoxInfo item() { + return items_[0]; +}
net1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh59.C =================================================================== --- eh59.C (nonexistent) +++ eh59.C (revision 816) @@ -0,0 +1,18 @@ +// { dg-do run } +// { dg-options "-O -funroll-loops" } + +struct A { + ~A(); +}; + +void foo(); + +int main() { + for (int i=0;i<4;i++) { + A a; + foo(); + } +} + +void foo() { } +A::~A() { }
eh59.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pmf9.C =================================================================== --- pmf9.C (nonexistent) +++ pmf9.C (revision 816) @@ -0,0 +1,24 @@ +// { dg-do run } +class K { +public: + int f(int i) { return i; } +}; + +class Q { +public: + Q() { kp = new K; } + int g(); +private: + K * kp; +}; + +int Q::g() { + return (kp->f)(42); +} + + +int main () { + Q q; + if (q.g() != 42) + return 1; +}
pmf9.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net9.C =================================================================== --- net9.C (nonexistent) +++ net9.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// { dg-options "-pedantic-errors" } + +const int ci=10, *pc = &ci, *const cpc = pc, **ppc; +int i, *p, *const cp = &i; + +int main() +{ + ci = 1; // { dg-error "" } bad + ci++; // { dg-error "" } bad + *pc = 2; // { dg-error "" } bad + cp = &ci; // { dg-error "" } bad + cpc++; // { dg-error "" } bad + p = pc; // { dg-error "" } bad +}
net9.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p8009.C =================================================================== --- p8009.C (nonexistent) +++ p8009.C (revision 816) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// prms-id: 8009 + +class A { +public: + int i; +}; + +class B : public A { + B(); +}; + +B::B() : i (-1) {} // { dg-error "" }
p8009.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p8460.C =================================================================== --- p8460.C (nonexistent) +++ p8460.C (revision 816) @@ -0,0 +1,17 @@ +// { dg-do assemble } +// prms-id: 8460 + +class A { +public: + A(); + A(int) { } + A(const A&) { } +private: +}; + +int main() +{ + A a; + + a.A(1); // { dg-error "" } cannot find name this way +}
p8460.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh8.C =================================================================== --- eh8.C (nonexistent) +++ eh8.C (revision 816) @@ -0,0 +1,20 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +extern "C" int printf(const char *, ...); + +int i; + +main() { + try { + try { + throw i; + } catch (char *) { + return 1; + } + return 1; + } catch (int i) { + return 0; + } + return 1; +}
eh8.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p700.C =================================================================== --- p700.C (nonexistent) +++ p700.C (revision 816) @@ -0,0 +1,2386 @@ +// { dg-do assemble } +// { dg-options "-Wno-deprecated" } +// { dg-error "limited range of data type" "16-bit target" { target xstormy16-*-* } 0 } +// prms-id: 700 + +//# 1 "../../../../libg++/etc/benchmarks/dhrystone.cc" + + + + + + + + + + + + + + + + + + + + + + + + + +//# 1 "../../../../libg++/etc/benchmarks/Int.h" 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +class Int +{ +protected: + int rep; + + + +public: + Int (); + Int (const int b); + Int (const Int& b); + ~Int(); + + operator int() const; + + inline virtual int val() const; + + inline virtual void operator = (const int); + inline virtual void operator = (const Int&); + + inline virtual void negate(); + inline virtual void complement(); + inline virtual void operator ++ (); + inline virtual void operator -- (); + + inline virtual void operator += (const Int & ); + inline virtual void operator -= (const Int & ); + inline virtual void operator *= (const Int & ); + inline virtual void operator /= (const Int & ); + inline virtual void operator %= (const Int & ); + inline virtual void operator |= (const Int & ); + inline virtual void operator &= (const Int & ); + inline virtual void operator ^= (const Int & ); + inline virtual void operator <<=(const Int & ); + inline virtual void operator >>=(const Int & ); + + + inline virtual void operator += (const int); + inline virtual void operator -= (const int); + inline virtual void operator *= (const int); + inline virtual void operator /= (const int); + inline virtual void operator %= (const int); + inline virtual void operator |= (const int); + inline virtual void operator &= (const int); + inline virtual void operator ^= (const int); + inline virtual void operator <<=(const int); + inline virtual void operator >>=(const int); + + +}; + +inline int Int::val() const { return rep; } +inline Int::operator int() const { return val(); } + +inline Int::Int () :rep(0) {} +inline Int::Int (const int b) :rep(b) {} +inline Int::Int (const Int& b) :rep(b.Int::val()) {} +inline Int::~Int() {} + +inline void Int::operator = (const int b) +{ rep = b; ; } +inline void Int::operator = (const Int& b) +{ rep = b.Int::val(); ; } + +inline void Int::complement() +{ rep = ~rep; ; } +inline void Int::negate() +{ rep = -rep; ; } +inline void Int::operator ++ () +{ ++rep; ; } +inline void Int::operator -- () +{ --rep; ; } + +inline void Int::operator += (const Int & b) +{ rep += b.Int::val(); ; } +inline void Int::operator -= (const Int & b) +{ rep -= b.Int::val(); ; } +inline void Int::operator *= (const Int & b) +{ rep *= b.Int::val(); ; } +inline void Int::operator /= (const Int & b) +{ rep /= b.Int::val(); ; } +inline void Int::operator %= (const Int & b) +{ rep %= b.Int::val(); ; } +inline void Int::operator |= (const Int & b) +{ rep |= b.Int::val(); ; } +inline void Int::operator &= (const Int & b) +{ rep &= b.Int::val(); ; } +inline void Int::operator ^= (const Int & b) +{ rep ^= b.Int::val(); ; } +inline void Int::operator <<=(const Int & b) +{ rep <<= b.Int::val(); ; } +inline void Int::operator >>=(const Int & b) +{ rep >>= b.Int::val(); ; } + + + +inline void Int::operator += (const int b) +{ rep += b; ; } +inline void Int::operator -= (const int b) +{ rep -= b; ; } +inline void Int::operator *= (const int b) +{ rep *= b; ; } +inline void Int::operator /= (const int b) +{ rep /= b; ; } +inline void Int::operator %= (const int b) +{ rep %= b; ; } +inline void Int::operator |= (const int b) +{ rep |= b; ; } +inline void Int::operator &= (const int b) +{ rep &= b; ; } +inline void Int::operator ^= (const int b) +{ rep ^= b; ; } +inline void Int::operator <<=(const int b) +{ rep <<= b; ; } +inline void Int::operator >>=(const int b) +{ rep >>= b; ; } + + +inline int& operator = (int& a, const Int & b) // { dg-warning "" } +{ a = b.Int::val(); return a;} +inline int& operator += (int& a, const Int & b) +{ a += b.Int::val(); return a; } +inline int& operator -= (int& a, const Int & b) +{ a -= b.Int::val(); return a;} +inline int& operator *= (int& a, const Int & b) +{ a *= b.Int::val(); return a;} +inline int& operator /= (int& a, const Int & b) +{ a /= b.Int::val(); return a;} +inline int& operator %= (int& a, const Int & b) +{ a %= b.Int::val(); return a;} +inline int& operator |= (int& a, const Int & b) +{ a |= b.Int::val(); return a;} +inline int& operator &= (int& a, const Int & b) +{ a &= b.Int::val(); return a;} +inline int& operator ^= (int& a, const Int & b) +{ a ^= b.Int::val(); return a;} +inline int& operator <<=(int& a, const Int & b) +{ a <<= b.Int::val(); return a;} +inline int& operator >>=(int& a, const Int & b) +{ a >>= b.Int::val(); return a;} + + + +//# 289 "../../../../libg++/etc/benchmarks/Int.h" + + +inline Int operator - (const Int & a) return r(a) // { dg-error "" } +{ r.negate(); } // { dg-error "" } +inline Int operator ~ (const Int & a) return r(a) // { dg-error "" } +{ r.complement(); } // { dg-error "" } + +inline Int operator + (const Int & a, const Int & b) return r(a) // { dg-error "" } +{ r += b.Int::val(); } // { dg-error "" } +inline Int operator - (const Int & a, const Int & b) return r(a) // { dg-error "" } +{ r -= b.Int::val(); } // { dg-error "" } +inline Int operator * (const Int & a, const Int & b) return r(a) // { dg-error "" } +{ r *= b.Int::val(); } // { dg-error "" } +inline Int operator / (const Int & a, const Int & b) return r(a) // { dg-error "" } +{ r /= b.Int::val(); } // { dg-error "" } +inline Int operator % (const Int & a, const Int & b) return r(a) // { dg-error "" } +{ r %= b.Int::val(); } // { dg-error "" } +inline Int operator << (const Int & a, const Int & b) return r(a) // { dg-error "" } +{ r <<= b.Int::val(); } // { dg-error "" } +inline Int operator >> (const Int & a, const Int & b) return r(a) // { dg-error "" } +{ r >>= b.Int::val(); } // { dg-error "" } +inline Int operator & (const Int & a, const Int & b) return r(a) // { dg-error "" } +{ r &= b.Int::val(); } // { dg-error "" } +inline Int operator | (const Int & a, const Int & b) return r(a) // { dg-error "" } +{ r |= b.Int::val(); } // { dg-error "" } +inline Int operator ^ (const Int & a, const Int & b) return r(a) // { dg-error "" } +{ r ^= b.Int::val(); } // { dg-error "" } + +inline Int operator + (const Int & a, const int b) return r(a) // { dg-error "" } +{ r += b; } // { dg-error "" } +inline Int operator - (const Int & a, const int b) return r(a) // { dg-error "" } +{ r -= b; } // { dg-error "" } +inline Int operator * (const Int & a, const int b) return r(a) // { dg-error "" } +{ r *= b; } // { dg-error "" } +inline Int operator / (const Int & a, const int b) return r(a) // { dg-error "" } +{ r /= b; } // { dg-error "" } +inline Int operator % (const Int & a, const int b) return r(a) // { dg-error "" } +{ r %= b; } // { dg-error "" } +inline Int operator << (const Int & a, const int b) return r(a) // { dg-error "" } +{ r <<= b; } // { dg-error "" } +inline Int operator >> (const Int & a, const int b) return r(a) // { dg-error "" } +{ r >>= b; } // { dg-error "" } +inline Int operator & (const Int & a, const int b) return r(a) // { dg-error "" } +{ r &= b; } // { dg-error "" } +inline Int operator | (const Int & a, const int b) return r(a) // { dg-error "" } +{ r |= b; } // { dg-error "" } +inline Int operator ^ (const Int & a, const int b) return r(a) // { dg-error "" } +{ r ^= b; } // { dg-error "" } + +inline Int operator + (const int a, const Int & b) return r(a) // { dg-error "" } +{ r += b.Int::val(); } // { dg-error "" } +inline Int operator - (const int a, const Int & b) return r(a) // { dg-error "" } +{ r -= b.Int::val(); } // { dg-error "" } +inline Int operator * (const int a, const Int & b) return r(a) // { dg-error "" } +{ r *= b.Int::val(); } // { dg-error "" } +inline Int operator / (const int a, const Int & b) return r(a) // { dg-error "" } +{ r /= b.Int::val(); } // { dg-error "" } +inline Int operator % (const int a, const Int & b) return r(a) // { dg-error "" } +{ r %= b.Int::val(); } // { dg-error "" } +inline Int operator << (const int a, const Int & b) return r(a) // { dg-error "" } +{ r <<= b.Int::val(); } // { dg-error "" } +inline Int operator >> (const int a, const Int & b) return r(a) // { dg-error "" } +{ r >>= b.Int::val(); } // { dg-error "" } +inline Int operator & (const int a, const Int & b) return r(a) // { dg-error "" } +{ r &= b.Int::val(); } // { dg-error "" } +inline Int operator | (const int a, const Int & b) return r(a) // { dg-error "" } +{ r |= b.Int::val(); } // { dg-error "" } +inline Int operator ^ (const int a, const Int & b) return r(a) // { dg-error "" } +{ r ^= b.Int::val(); } // { dg-error "" } + + + +inline int operator ! (const Int & a) { return !a.Int::val(); } + +inline int operator == (const Int & a, const Int & b) +{ return a.Int::val() == b.Int::val(); } +inline int operator != (const Int & a, const Int & b) +{ return a.Int::val() != b.Int::val(); } +inline int operator < (const Int & a, const Int & b) +{ return a.Int::val() < b.Int::val(); } +inline int operator <= (const Int & a, const Int & b) +{ return a.Int::val() <= b.Int::val(); } +inline int operator > (const Int & a, const Int & b) +{ return a.Int::val() > b.Int::val(); } +inline int operator >= (const Int & a, const Int & b) +{ return a.Int::val() >= b.Int::val(); } + +inline int operator == (const Int & a, const int b) +{ return a.Int::val() == b; } +inline int operator != (const Int & a, const int b) +{ return a.Int::val() != b; } +inline int operator < (const Int & a, const int b) +{ return a.Int::val() < b; } +inline int operator <= (const Int & a, const int b) +{ return a.Int::val() <= b; } +inline int operator > (const Int & a, const int b) +{ return a.Int::val() > b; } +inline int operator >= (const Int & a, const int b) +{ return a.Int::val() >= b; } + +inline int operator == (const int a, const Int & b) +{ return a == b.Int::val(); } +inline int operator != (const int a, const Int & b) +{ return a != b.Int::val(); } +inline int operator < (const int a, const Int & b) +{ return a < b.Int::val(); } +inline int operator <= (const int a, const Int & b) +{ return a <= b.Int::val(); } +inline int operator > (const int a, const Int & b) +{ return a > b.Int::val(); } +inline int operator >= (const int a, const Int & b) +{ return a >= b.Int::val(); } + + + +//# 26 "../../../../libg++/etc/benchmarks/dhrystone.cc" 2 + +//# 1 "../../../../libg++/etc/benchmarks/Char.h" 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +class Char +{ +protected: + char rep; + + + +public: + Char (); + Char (const char b); + Char (const Char& b); + ~Char(); + + operator char() const; + + inline virtual char val() const; + + inline virtual void operator = (const char); + inline virtual void operator = (const Char&); + + inline virtual void negate(); + inline virtual void complement(); + inline virtual void operator ++ (); + inline virtual void operator -- (); + + inline virtual void operator += (const Char & ); + inline virtual void operator -= (const Char & ); + inline virtual void operator *= (const Char & ); + inline virtual void operator /= (const Char & ); + inline virtual void operator %= (const Char & ); + inline virtual void operator |= (const Char & ); + inline virtual void operator &= (const Char & ); + inline virtual void operator ^= (const Char & ); + inline virtual void operator <<=(const Char & ); + inline virtual void operator >>=(const Char & ); + + + inline virtual void operator += (const char); + inline virtual void operator -= (const char); + inline virtual void operator *= (const char); + inline virtual void operator /= (const char); + inline virtual void operator %= (const char); + inline virtual void operator |= (const char); + inline virtual void operator &= (const char); + inline virtual void operator ^= (const char); + inline virtual void operator <<=(const char); + inline virtual void operator >>=(const char); + + +}; + +inline char Char::val() const { return rep; } +inline Char::operator char() const { return val(); } + +inline Char::Char () :rep(0) {} +inline Char::Char (const char b) :rep(b) {} +inline Char::Char (const Char& b) :rep(b.Char::val()) {} +inline Char::~Char() {} + +inline void Char::operator = (const char b) +{ rep = b; ; } +inline void Char::operator = (const Char& b) +{ rep = b.Char::val(); ; } + +inline void Char::complement() +{ rep = ~rep; ; } +inline void Char::negate() +{ rep = -rep; ; } +inline void Char::operator ++ () +{ ++rep; ; } +inline void Char::operator -- () +{ --rep; ; } + +inline void Char::operator += (const Char & b) +{ rep += b.Char::val(); ; } +inline void Char::operator -= (const Char & b) +{ rep -= b.Char::val(); ; } +inline void Char::operator *= (const Char & b) +{ rep *= b.Char::val(); ; } +inline void Char::operator /= (const Char & b) +{ rep /= b.Char::val(); ; } +inline void Char::operator %= (const Char & b) +{ rep %= b.Char::val(); ; } +inline void Char::operator |= (const Char & b) +{ rep |= b.Char::val(); ; } +inline void Char::operator &= (const Char & b) +{ rep &= b.Char::val(); ; } +inline void Char::operator ^= (const Char & b) +{ rep ^= b.Char::val(); ; } +inline void Char::operator <<=(const Char & b) +{ rep <<= b.Char::val(); ; } +inline void Char::operator >>=(const Char & b) +{ rep >>= b.Char::val(); ; } + + + +inline void Char::operator += (const char b) +{ rep += b; ; } +inline void Char::operator -= (const char b) +{ rep -= b; ; } +inline void Char::operator *= (const char b) +{ rep *= b; ; } +inline void Char::operator /= (const char b) +{ rep /= b; ; } +inline void Char::operator %= (const char b) +{ rep %= b; ; } +inline void Char::operator |= (const char b) +{ rep |= b; ; } +inline void Char::operator &= (const char b) +{ rep &= b; ; } +inline void Char::operator ^= (const char b) +{ rep ^= b; ; } +inline void Char::operator <<=(const char b) +{ rep <<= b; ; } +inline void Char::operator >>=(const char b) +{ rep >>= b; ; } + + +inline char& operator = (char& a, const Char & b) // { dg-warning "" } +{ a = b.Char::val(); return a;} +inline char& operator += (char& a, const Char & b) +{ a += b.Char::val(); return a; } +inline char& operator -= (char& a, const Char & b) +{ a -= b.Char::val(); return a;} +inline char& operator *= (char& a, const Char & b) +{ a *= b.Char::val(); return a;} +inline char& operator /= (char& a, const Char & b) +{ a /= b.Char::val(); return a;} +inline char& operator %= (char& a, const Char & b) +{ a %= b.Char::val(); return a;} +inline char& operator |= (char& a, const Char & b) +{ a |= b.Char::val(); return a;} +inline char& operator &= (char& a, const Char & b) +{ a &= b.Char::val(); return a;} +inline char& operator ^= (char& a, const Char & b) +{ a ^= b.Char::val(); return a;} +inline char& operator <<=(char& a, const Char & b) +{ a <<= b.Char::val(); return a;} +inline char& operator >>=(char& a, const Char & b) +{ a >>= b.Char::val(); return a;} + + + +//# 291 "../../../../libg++/etc/benchmarks/Char.h" + + +inline Char operator - (const Char & a) return r(a) // { dg-error "" } +{ r.negate(); } // { dg-error "" } +inline Char operator ~ (const Char & a) return r(a) // { dg-error "" } +{ r.complement(); } // { dg-error "" } + +inline Char operator + (const Char & a, const Char & b) return r(a) // { dg-error "" } +{ r += b.Char::val(); } // { dg-error "" } +inline Char operator - (const Char & a, const Char & b) return r(a) // { dg-error "" } +{ r -= b.Char::val(); } // { dg-error "" } +inline Char operator * (const Char & a, const Char & b) return r(a) // { dg-error "" } +{ r *= b.Char::val(); } // { dg-error "" } +inline Char operator / (const Char & a, const Char & b) return r(a) // { dg-error "" } +{ r /= b.Char::val(); } // { dg-error "" } +inline Char operator % (const Char & a, const Char & b) return r(a) // { dg-error "" } +{ r %= b.Char::val(); } // { dg-error "" } +inline Char operator << (const Char & a, const Char & b) return r(a) // { dg-error "" } +{ r <<= b.Char::val(); } // { dg-error "" } +inline Char operator >> (const Char & a, const Char & b) return r(a) // { dg-error "" } +{ r >>= b.Char::val(); } // { dg-error "" } +inline Char operator & (const Char & a, const Char & b) return r(a) // { dg-error "" } +{ r &= b.Char::val(); } // { dg-error "" } +inline Char operator | (const Char & a, const Char & b) return r(a) // { dg-error "" } +{ r |= b.Char::val(); } // { dg-error "" } +inline Char operator ^ (const Char & a, const Char & b) return r(a) // { dg-error "" } +{ r ^= b.Char::val(); } // { dg-error "" } + +inline Char operator + (const Char & a, const char b) return r(a) // { dg-error "" } +{ r += b; } // { dg-error "" } +inline Char operator - (const Char & a, const char b) return r(a) // { dg-error "" } +{ r -= b; } // { dg-error "" } +inline Char operator * (const Char & a, const char b) return r(a) // { dg-error "" } +{ r *= b; } // { dg-error "" } +inline Char operator / (const Char & a, const char b) return r(a) // { dg-error "" } +{ r /= b; } // { dg-error "" } +inline Char operator % (const Char & a, const char b) return r(a) // { dg-error "" } +{ r %= b; } // { dg-error "" } +inline Char operator << (const Char & a, const char b) return r(a) // { dg-error "" } +{ r <<= b; } // { dg-error "" } +inline Char operator >> (const Char & a, const char b) return r(a) // { dg-error "" } +{ r >>= b; } // { dg-error "" } +inline Char operator & (const Char & a, const char b) return r(a) // { dg-error "" } +{ r &= b; } // { dg-error "" } +inline Char operator | (const Char & a, const char b) return r(a) // { dg-error "" } +{ r |= b; } // { dg-error "" } +inline Char operator ^ (const Char & a, const char b) return r(a) // { dg-error "" } +{ r ^= b; } // { dg-error "" } + +inline Char operator + (const char a, const Char & b) return r(a) // { dg-error "" } +{ r += b.Char::val(); } // { dg-error "" } +inline Char operator - (const char a, const Char & b) return r(a) // { dg-error "" } +{ r -= b.Char::val(); } // { dg-error "" } +inline Char operator * (const char a, const Char & b) return r(a) // { dg-error "" } +{ r *= b.Char::val(); } // { dg-error "" } +inline Char operator / (const char a, const Char & b) return r(a) // { dg-error "" } +{ r /= b.Char::val(); } // { dg-error "" } +inline Char operator % (const char a, const Char & b) return r(a) // { dg-error "" } +{ r %= b.Char::val(); } // { dg-error "" } +inline Char operator << (const char a, const Char & b) return r(a) // { dg-error "" } +{ r <<= b.Char::val(); } // { dg-error "" } +inline Char operator >> (const char a, const Char & b) return r(a) // { dg-error "" } +{ r >>= b.Char::val(); } // { dg-error "" } +inline Char operator & (const char a, const Char & b) return r(a) // { dg-error "" } +{ r &= b.Char::val(); } // { dg-error "" } +inline Char operator | (const char a, const Char & b) return r(a) // { dg-error "" } +{ r |= b.Char::val(); } // { dg-error "" } +inline Char operator ^ (const char a, const Char & b) return r(a) // { dg-error "" } +{ r ^= b.Char::val(); } // { dg-error "" } + + + +inline char operator ! (const Char & a) { return !a.Char::val(); } + +inline char operator == (const Char & a, const Char & b) +{ return a.Char::val() == b.Char::val(); } +inline char operator != (const Char & a, const Char & b) +{ return a.Char::val() != b.Char::val(); } +inline char operator < (const Char & a, const Char & b) +{ return a.Char::val() < b.Char::val(); } +inline char operator <= (const Char & a, const Char & b) +{ return a.Char::val() <= b.Char::val(); } +inline char operator > (const Char & a, const Char & b) +{ return a.Char::val() > b.Char::val(); } +inline char operator >= (const Char & a, const Char & b) +{ return a.Char::val() >= b.Char::val(); } + +inline char operator == (const Char & a, const char b) +{ return a.Char::val() == b; } +inline char operator != (const Char & a, const char b) +{ return a.Char::val() != b; } +inline char operator < (const Char & a, const char b) +{ return a.Char::val() < b; } +inline char operator <= (const Char & a, const char b) +{ return a.Char::val() <= b; } +inline char operator > (const Char & a, const char b) +{ return a.Char::val() > b; } +inline char operator >= (const Char & a, const char b) +{ return a.Char::val() >= b; } + +inline char operator == (const char a, const Char & b) +{ return a == b.Char::val(); } +inline char operator != (const char a, const Char & b) +{ return a != b.Char::val(); } +inline char operator < (const char a, const Char & b) +{ return a < b.Char::val(); } +inline char operator <= (const char a, const Char & b) +{ return a <= b.Char::val(); } +inline char operator > (const char a, const Char & b) +{ return a > b.Char::val(); } +inline char operator >= (const char a, const Char & b) +{ return a >= b.Char::val(); } + + + +//# 27 "../../../../libg++/etc/benchmarks/dhrystone.cc" 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +//# 1 "/giga/hgs/lib/g++-include/sys/types.h" 1 + + +//# 1 "/giga/hgs/lib/g++-include/stddef.h" 1 + +extern "C" { +//# 1 "/giga/hgs/lib/gcc/sun4/cygnus-1.96/include/stddef.h" 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +typedef int ptrdiff_t; + + + + + + + + + + + + + + + + + + + + + +typedef int size_t; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +//# 3 "/giga/hgs/lib/g++-include/stddef.h" 2 + +} +//# 73 "/giga/hgs/lib/g++-include/stddef.h" + +//# 3 "/giga/hgs/lib/g++-include/sys/types.h" 2 + + + + +extern "C" +{ + + + + + + + + + + + + + + + + + + + + + + + + + + +//# 1 "/usr/include/sys/types.h" 1 + + + + + + + + + + + + + + + +//# 1 "/usr/include/sys/stdtypes.h" 1 + + + + + + + + + + + + + +typedef int sigset_t; + +typedef unsigned int speed_t; +typedef unsigned long tcflag_t; +typedef unsigned char cc_t; +typedef int pid_t; + +typedef unsigned short mode_t; +typedef short nlink_t; + +typedef long clock_t; +typedef long time_t; + +typedef int size_t; +typedef int ptrdiff_t; + + +//# 16 "/usr/include/sys/types.h" 2 + + + +//# 1 "/usr/include/sys/sysmacros.h" 1 + + + + + + + + + + + + + + + + + + + +//# 19 "/usr/include/sys/types.h" 2 + + + + + +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +typedef unsigned short ushort; +typedef unsigned int uint; + + + + + + + + + + + + + + + +typedef struct _physadr_t { int r[1]; } *physadr_t; +typedef struct label_t { + int val[2]; +} label_t; + + + + + + + +typedef struct _quad_t { long val[2]; } quad_t; +typedef long daddr_t; +typedef char * caddr_t; +typedef unsigned long ino_t; +typedef short dev_t; +typedef long off_t; +typedef unsigned short uid_t; +typedef unsigned short gid_t; +typedef long key_t; +typedef char * addr_t; + + + + + + + + + + + + + + +typedef long fd_mask; + + + + + + + + + +typedef struct fd_set { + fd_mask fds_bits[(((256 )+(( (sizeof (fd_mask) * 8 ) )-1))/( (sizeof (fd_mask) * 8 ) )) ]; +} fd_set; + + + + + + + +//# 113 "/usr/include/sys/types.h" + + + +//# 35 "/giga/hgs/lib/g++-include/sys/types.h" 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + + + + +//# 310 "../../../../libg++/etc/benchmarks/dhrystone.cc" 2 + +//# 1 "/giga/hgs/lib/g++-include/sys/times.h" 1 +//# 1 "/giga/hgs/lib/g++-include/time.h" 1 + + + + + +//# 1 "/giga/hgs/lib/g++-include/stddef.h" 1 + +extern "C" { +//# 1 "/giga/hgs/lib/gcc/sun4/cygnus-1.96/include/stddef.h" 1 +//# 94 "/giga/hgs/lib/gcc/sun4/cygnus-1.96/include/stddef.h" + +//# 3 "/giga/hgs/lib/g++-include/stddef.h" 2 + +} +//# 73 "/giga/hgs/lib/g++-include/stddef.h" + +//# 6 "/giga/hgs/lib/g++-include/time.h" 2 + +//# 1 "/giga/hgs/lib/g++-include/stdio.h" 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +//#pragma interface + + + + + + + + + + + + + + + + + + + +//# 80 "/giga/hgs/lib/g++-include/stdio.h" + + + +//# 117 "/giga/hgs/lib/g++-include/stdio.h" + + + + + +//# 153 "/giga/hgs/lib/g++-include/stdio.h" + + + +extern "C" { + + + + + + + + + + + + + + + + + + + + + + + + + + + + +//# 1 "/usr/include/stdio.h" 1 + + + + + +extern struct _iobuf { + int _cnt; + unsigned char *_ptr; + unsigned char *_base; + int _bufsiz; + short _flag; + char _file; +} _iob[]; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +extern struct _iobuf *c_proto_fopen (); +extern struct _iobuf *c_proto_fdopen (); +extern struct _iobuf *c_proto_freopen (); +extern struct _iobuf *c_proto_popen (); +extern struct _iobuf *tmpfile(); +extern long ftell(_iobuf *); +extern char *fgets(char *, int, _iobuf *); +extern char *gets(char *); +extern char *c_proto_sprintf (); +extern char *ctermid(); +extern char *cuserid(); +extern char *c_proto_tempnam (); +extern char *tmpnam(); + + + + + + +//# 185 "/giga/hgs/lib/g++-include/stdio.h" 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} +//# 417 "/giga/hgs/lib/g++-include/stdio.h" + + + + + + +extern "C" { + + + + + + + +int _doprnt(const char*, void*, struct _iobuf *); +int _doscan(struct _iobuf *, const char*, ...); +int _filbuf(struct _iobuf *); +int _flsbuf(unsigned, struct _iobuf *); + +int fclose(struct _iobuf *); +struct _iobuf * fdopen(int, const char*); +int fflush(struct _iobuf *); +int fgetc(struct _iobuf *); +char* fgets(char*, int, struct _iobuf *); +struct _iobuf * fopen(const char*, const char*); +int fprintf(struct _iobuf *, const char* ...); +int fputc(int, struct _iobuf *); +int fputs(const char*, struct _iobuf *); +int fread(void*, int, int, struct _iobuf *); + + + +struct _iobuf * freopen(const char*, const char*, struct _iobuf *); + +int fscanf(struct _iobuf *, const char* ...); +int fseek(struct _iobuf *, long, int); +long ftell(struct _iobuf *); +int fwrite(const void*, int, int, struct _iobuf *); +char* gets(char*); +int getw(struct _iobuf *); +int pclose(struct _iobuf *); +void perror(const char*); +struct _iobuf * popen(const char*, const char*); +int printf(const char* ...); +int puts(const char*); +int putw(int, struct _iobuf *); +int rewind(struct _iobuf *); +int scanf(const char* ...); +int setbuf(struct _iobuf *, char*); +int setbuffer(struct _iobuf *, char*, int); +int setlinebuf(struct _iobuf *); +int setvbuf(struct _iobuf *, char*, int, int); +int sscanf(char*, const char* ...); +struct _iobuf * tmpfile(); +int ungetc(int, struct _iobuf *); +int vfprintf(struct _iobuf *, const char*, ...); + + + + +int vprintf(const char*, ... ); + + + + + +int sprintf(char*, const char*, ...); +char* vsprintf(char*, const char*, ...); + + +} + + + + + + + + + + + + + + + + + +//# 7 "/giga/hgs/lib/g++-include/time.h" 2 + + +//# 1 "/giga/hgs/lib/g++-include/sys/types.h" 1 + + +//# 1 "/giga/hgs/lib/g++-include/stddef.h" 1 + +extern "C" { +//# 1 "/giga/hgs/lib/gcc/sun4/cygnus-1.96/include/stddef.h" 1 +//# 94 "/giga/hgs/lib/gcc/sun4/cygnus-1.96/include/stddef.h" + +//# 3 "/giga/hgs/lib/g++-include/stddef.h" 2 + +} +//# 73 "/giga/hgs/lib/g++-include/stddef.h" + +//# 3 "/giga/hgs/lib/g++-include/sys/types.h" 2 + + + + +extern "C" +{ + + + + + + + + + + + + + + + + + + + + + + + + + + +//# 1 "/usr/include/sys/types.h" 1 + + + + + + + + +//# 115 "/usr/include/sys/types.h" + +//# 35 "/giga/hgs/lib/g++-include/sys/types.h" 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + + + + +//# 9 "/giga/hgs/lib/g++-include/time.h" 2 + + +extern "C" { + + + + + + + + + + + + + + + + + +//# 42 "/giga/hgs/lib/g++-include/time.h" + + + + + + + +//# 1 "/usr/include/time.h" 1 + + + + + +//# 1 "/usr/include/sys/stdtypes.h" 1 + + + + + + + + + + +//# 32 "/usr/include/sys/stdtypes.h" + +//# 6 "/usr/include/time.h" 2 + + + + +struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + char *tm_zone; + long tm_gmtoff; +}; + +extern struct tm *c_proto_gmtime (), *c_proto_localtime (); +extern char *c_proto_asctime (), *c_proto_ctime (); +extern void c_proto_tzset (), c_proto_tzsetwall (); +extern int dysize(int); +extern time_t timelocal(), timegm(); + + +//# 49 "/giga/hgs/lib/g++-include/time.h" 2 + + +//# 1 "/usr/include/sys/times.h" 1 + + + + + + + + + +//# 1 "/giga/hgs/lib/g++-include/sys/types.h" 1 + + +//# 1 "/giga/hgs/lib/g++-include/stddef.h" 1 + +extern "C" { +//# 1 "/giga/hgs/lib/gcc/sun4/cygnus-1.96/include/stddef.h" 1 +//# 94 "/giga/hgs/lib/gcc/sun4/cygnus-1.96/include/stddef.h" + +//# 3 "/giga/hgs/lib/g++-include/stddef.h" 2 + +} +//# 73 "/giga/hgs/lib/g++-include/stddef.h" + +//# 3 "/giga/hgs/lib/g++-include/sys/types.h" 2 + + + + +extern "C" +{ + + + + + + + + + + + + + + + + + + + + + + + + + + +//# 1 "/usr/include/sys/types.h" 1 + + + + + + + + +//# 115 "/usr/include/sys/types.h" + +//# 35 "/giga/hgs/lib/g++-include/sys/types.h" 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + + + + +//# 10 "/usr/include/sys/times.h" 2 + + +struct tms { + clock_t tms_utime; + clock_t tms_stime; + clock_t tms_cutime; + clock_t tms_cstime; +}; + + +clock_t times(tms * ); + + + +//# 51 "/giga/hgs/lib/g++-include/time.h" 2 + + + + + + + + + + + + + + + + + + + + + +extern struct tm* localtime(long*); +extern struct tm* gmtime(long*); +extern char* ctime(long*); +extern char* asctime(struct tm*); +extern void tzset(); +extern void tzsetwall(); + + + + + + +extern long times(struct tms*); + + +//# 97 "/giga/hgs/lib/g++-include/time.h" + +extern char* timezone(int, int); +extern int getitimer(int, struct itimerval*); +extern int setitimer(int, struct itimerval*, struct itimerval*); +extern int gettimeofday(struct timeval*, struct timezone*); +extern int settimeofday(struct timeval*, struct timezone*); +extern int stime(long*); +int dysize(int); + + + + + + + + +long clock(void); + +long time(long*); +unsigned ualarm(unsigned, unsigned); +unsigned usleep(unsigned); +int profil(char*, int, int, int); + +} + + + +//# 1 "/giga/hgs/lib/g++-include/sys/times.h" 2 + +//# 311 "../../../../libg++/etc/benchmarks/dhrystone.cc" 2 + + + + + + + + + + + + + + + + + + + + + + + + +typedef enum {Ident1, Ident2, Ident3, Ident4, Ident5} Enumeration; + + + + +typedef Int OneToThirty; +typedef Int OneToFifty; +typedef Char CapitalLetter; +typedef Char String30[31]; +typedef Int Array1Dim[51]; +typedef Int Array2Dim[51][51]; + +struct Record +{ + struct Record *PtrComp; + Enumeration Discr; + Enumeration EnumComp; + OneToFifty IntComp; + String30 StringComp; +}; + +typedef struct Record RecordType; +typedef RecordType * RecordPtr; +typedef int boolean; + + + + + + + + + + + +extern "C" { +extern int printf(const char* ...); +extern void exit(int); +} + +void Proc0(); +void Proc1(RecordPtr PtrParIn); +void Proc2(OneToFifty *IntParIO); +void Proc3(RecordPtr *PtrParOut); +void Proc4(); +void Proc5(); +boolean Func3(Enumeration EnumParIn); +void Proc6( Enumeration EnumParIn, Enumeration *EnumParOut); +void Proc7(OneToFifty IntParI1, OneToFifty IntParI2, OneToFifty *IntParOut); +void Proc8(Array1Dim Array1Par, + Array2Dim Array2Par, + OneToFifty IntParI1, + OneToFifty IntParI2); +Enumeration Func1(CapitalLetter CharPar1, CapitalLetter CharPar2); +boolean Func2(String30 StrParI1, String30 StrParI2); +boolean Func3(Enumeration EnumParIn); + +void mystrcpy(String30 s, const char* t) +{ + for (; *t != '\0'; ++s, ++t) *s = *t; + *s = '\0'; +} + +char mystrcmp(String30 s, String30 t) +{ + for (; *s == *t; ++s, ++t) if (*s == '\0') return 0; + return char(*s - *t); +} + + + +main() +{ + Proc0(); + exit(0); +} + + + + +Int IntGlob; +boolean BoolGlob; +char Char1Glob; +char Char2Glob; +Array1Dim Array1Glob; +Array2Dim Array2Glob; +RecordPtr PtrGlb; +RecordPtr PtrGlbNext; + +void Proc0() +{ + OneToFifty IntLoc1; + OneToFifty IntLoc2; + OneToFifty IntLoc3; + char CharLoc; + char CharIndex; + Enumeration EnumLoc; + String30 String1Loc; + String30 String2Loc; + +//# 445 "../../../../libg++/etc/benchmarks/dhrystone.cc" + + + time_t starttime; + time_t benchtime; + time_t nulltime; + struct tms Tms; + register unsigned int i; + + times(&Tms); starttime = Tms.tms_utime; + for (i = 0; i < 500000 ; ++i); + times(&Tms); + nulltime = Tms.tms_utime - starttime; + + + PtrGlbNext = new Record; + PtrGlb = new Record; + PtrGlb->PtrComp = PtrGlbNext; + PtrGlb->Discr = Ident1; + PtrGlb->EnumComp = Ident3; + PtrGlb->IntComp = 40; + mystrcpy(PtrGlb->StringComp, "DHRYSTONE PROGRAM, SOME STRING"); + mystrcpy(String1Loc, "JUST INITIALIZED TO SOME JUNK."); + + + + + + + + + times(&Tms); starttime = Tms.tms_utime; + + for (i = 0; i < 500000 ; ++i) + { + + Proc5(); + Proc4(); + IntLoc1 = 2; + IntLoc2 = 3; + mystrcpy(String2Loc, "DHRYSTONE PROGRAM, 2'ND STRING"); + EnumLoc = Ident2; + BoolGlob = ! Func2(String1Loc, String2Loc); + while (IntLoc1 < IntLoc2) + { + IntLoc3 = 5 * IntLoc1 - IntLoc2; + Proc7(IntLoc1, IntLoc2, &IntLoc3); + ++IntLoc1; + } + Proc8(Array1Glob, Array2Glob, IntLoc1, IntLoc3); + Proc1(PtrGlb); + for (CharIndex = 'A'; CharIndex <= Char2Glob; ++CharIndex) + if (EnumLoc == Func1(CharIndex, 'C')) + Proc6(Ident1, &EnumLoc); + IntLoc3 = IntLoc2 * IntLoc1; + IntLoc2 = IntLoc3 / IntLoc1; + IntLoc2 = 7 * (IntLoc3 - IntLoc2) - IntLoc1; + Proc2(&IntLoc1); + } + + + + + + + + + + + + + + times(&Tms); + benchtime = Tms.tms_utime - starttime - nulltime; + printf("Dhrystone time for %ld passes = %ld\n", + (long) 500000 , benchtime/60 ); + printf("This machine benchmarks at %ld dhrystones/second\n", + ((long) 500000 ) * 60 / benchtime); + + +} + +void Proc1(RecordPtr PtrParIn) +{ + + + (*(PtrParIn->PtrComp)) = *PtrGlb ; + PtrParIn->IntComp = 5; + (*(PtrParIn->PtrComp)) .IntComp = PtrParIn->IntComp; + (*(PtrParIn->PtrComp)) .PtrComp = PtrParIn->PtrComp; + + Proc3(&((*(PtrParIn->PtrComp)) .PtrComp)); + if ((*(PtrParIn->PtrComp)) .Discr == Ident1) + { + (*(PtrParIn->PtrComp)) .IntComp = 6; + Proc6(PtrParIn->EnumComp, &(*(PtrParIn->PtrComp)) .EnumComp); + (*(PtrParIn->PtrComp)) .PtrComp = PtrGlb->PtrComp; + Proc7((*(PtrParIn->PtrComp)) .IntComp, 10, &(*(PtrParIn->PtrComp)) .IntComp); + } + else + *PtrParIn = (*(PtrParIn->PtrComp)) ; + + +} + +void Proc2(OneToFifty *IntParIO) +{ + OneToFifty IntLoc; + Enumeration EnumLoc; + + IntLoc = *IntParIO + 10; + for(;;) + { + if (Char1Glob == 'A') + { + --IntLoc; + *IntParIO = IntLoc - IntGlob; + EnumLoc = Ident1; + } + if (EnumLoc == Ident1) + break; + } +} + +void Proc3(RecordPtr *PtrParOut) +{ + if (PtrGlb != 0 ) + *PtrParOut = PtrGlb->PtrComp; + else + IntGlob = 100; + Proc7(10, IntGlob, &PtrGlb->IntComp); +} + +void Proc4() +{ + boolean BoolLoc; + + BoolLoc = Char1Glob == 'A'; + BoolLoc |= BoolGlob; + Char2Glob = 'B'; +} + +void Proc5() +{ + Char1Glob = 'A'; + BoolGlob = 0 ; +} + + + + +void Proc6( Enumeration EnumParIn, Enumeration *EnumParOut) +{ + *EnumParOut = EnumParIn; + if (! Func3(EnumParIn) ) + *EnumParOut = Ident4; + switch (EnumParIn) + { + case Ident1: *EnumParOut = Ident1; break; + case Ident2: if (IntGlob > 100) *EnumParOut = Ident1; + else *EnumParOut = Ident4; + break; + case Ident3: *EnumParOut = Ident2; break; + case Ident4: break; + case Ident5: *EnumParOut = Ident3; + } +} + +void Proc7(OneToFifty IntParI1, OneToFifty IntParI2, OneToFifty *IntParOut) +{ + OneToFifty IntLoc; + + IntLoc = IntParI1 + 2; + *IntParOut = IntParI2 + IntLoc; +} + +void Proc8(Array1Dim Array1Par, + Array2Dim Array2Par, + OneToFifty IntParI1, + OneToFifty IntParI2) +{ + OneToFifty IntLoc; + OneToFifty IntIndex; + + IntLoc = IntParI1 + 5; + Array1Par[IntLoc] = IntParI2; + Array1Par[IntLoc+1] = Array1Par[IntLoc]; + Array1Par[IntLoc+30] = IntLoc; + for (IntIndex = IntLoc; IntIndex <= (IntLoc+1); ++IntIndex) + Array2Par[IntLoc][IntIndex] = IntLoc; + ++Array2Par[IntLoc][IntLoc-1]; + Array2Par[IntLoc+20][IntLoc] = Array1Par[IntLoc]; + IntGlob = 5; +} + +Enumeration Func1(CapitalLetter CharPar1, CapitalLetter CharPar2) +{ + CapitalLetter CharLoc1; + CapitalLetter CharLoc2; + + CharLoc1 = CharPar1; + CharLoc2 = CharLoc1; + if (CharLoc2 != CharPar2) + return (Ident1); + else + return (Ident2); +} + +boolean Func2(String30 StrParI1, String30 StrParI2) +{ + OneToThirty IntLoc; + CapitalLetter CharLoc; + + IntLoc = 1; + while (IntLoc <= 1) + if (Func1(StrParI1[IntLoc], StrParI2[IntLoc+1]) == Ident1) + { + CharLoc = 'A'; + ++IntLoc; + } + if (CharLoc >= 'W' && CharLoc <= 'Z') + IntLoc = 7; + if (CharLoc == 'X') + return( 1 ); + else + { + if (mystrcmp(StrParI1, StrParI2) > 0) + { + IntLoc += 7; + return ( 1 ); + } + else + return ( 0 ); + } +} + +boolean Func3(Enumeration EnumParIn) +{ + Enumeration EnumLoc; + + EnumLoc = EnumParIn; + if (EnumLoc == Ident3) return ( 1 ); + return ( 0 ); +}
p700.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3579.C =================================================================== --- p3579.C (nonexistent) +++ p3579.C (revision 816) @@ -0,0 +1,40 @@ +// { dg-do run } +// prms-id: 3579 + +extern "C" int printf(const char *, ...); + +int num_x; + +class Y { +public: + Y () { printf("Y() this: %x\n", this); } + ~Y () { printf("~Y() this: %x\n", this); } +}; + +class X { +public: + X () { + ++num_x; + printf("X() this: %x\n", this); + Y y; + *this = (X) y; + } + + X (const Y & yy) { printf("X(const Y&) this: %x\n", this); ++num_x; } + X & operator = (const X & xx) { + printf("X.op=(X&) this: %x\n", this); + return *this; + } + + ~X () { printf("~X() this: %x\n", this); --num_x; } +}; + +int main (int, char **) { + { X anX; } + if (num_x) { + printf("FAIL\n"); + return 1; + } + printf("PASS\n"); + return 0; +}
p3579.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p5469a.C =================================================================== --- p5469a.C (nonexistent) +++ p5469a.C (revision 816) @@ -0,0 +1,22 @@ +// { dg-do run } +// prms-id: 5469 + +int count; + +class A { + A(); + A(const A&); +public: + A(int) { ++count; } + ~A() { --count; } + int operator== (const A& r) { return 1; } +}; + +int main() { + { + A a (1); + if (a == 2 || a == 1) + ; + } + return count; +}
p5469a.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: warn2.C =================================================================== --- warn2.C (nonexistent) +++ warn2.C (revision 816) @@ -0,0 +1,26 @@ +// { dg-do assemble } +// { dg-options "-Wall" } + +enum Boolean { + Ok = 0, + NotOk = 1, +}; + +enum OpResult { + Succeeded = 0, + TempFail = 1, + PermFail = 2, +}; + +OpResult fn1() { + return TempFail; +} + +extern void foo(); + +int +main () { + if (fn1() == Ok) { // { dg-warning "" } + foo(); + } +}
warn2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net22.C =================================================================== --- net22.C (nonexistent) +++ net22.C (revision 816) @@ -0,0 +1,14 @@ +// { dg-do assemble } +class Parent { +public: + Parent() {} + Parent( char *s ) {} +}; + +class Child : public Parent { // { dg-error "" } called +}; + +int main() { + Child c( "String initializer" ); // { dg-error "" } bad + return 0; +}
net22.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dyncast7.C =================================================================== --- dyncast7.C (nonexistent) +++ dyncast7.C (revision 816) @@ -0,0 +1,29 @@ +// { dg-do run } +// { dg-options "-fexceptions" } + +#include +#include + +class A { +public: + virtual void j () {} +}; + +class B : public A { }; + +void x (A& a) { + // These should all work. + const B& b2 = dynamic_cast(a); + const B& b3 = dynamic_cast((const A&)a); + const B& b4 = dynamic_cast(a); +} + +int main() { + try { + B b; + x (b); + } catch (std::exception& e) { + // If we get a bad_cast, it is wrong. + return 1; + } +}
dyncast7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p12306a.C =================================================================== --- p12306a.C (nonexistent) +++ p12306a.C (revision 816) @@ -0,0 +1,36 @@ +// { dg-do run } +// prms-id: 12306 +// a net report of the same problem as 12306 + +class a { +public: + int i; +}; + +class g : virtual public a { +}; + +class b : virtual public a { + int j; +}; + +class c : public g, public b { +}; + +class d { +public: + virtual class b* get() {return 0;} +}; + +class f : public d { +public: + virtual class b* get() {return &_c;} + c _c; +}; + +int main(void) { + f D; + b* bp=D.get(); + D._c.i = 42; + return &D._c.i != &bp->i; +}
p12306a.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net47.C =================================================================== --- net47.C (nonexistent) +++ net47.C (revision 816) @@ -0,0 +1,8 @@ +// { dg-do assemble } +// { dg-options "-w -fpermissive" } + +class foo {}; +class bar : foo { +public: + bar () : () {} +};
net47.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p784.C =================================================================== --- p784.C (nonexistent) +++ p784.C (revision 816) @@ -0,0 +1,3658 @@ +// { dg-do assemble } +// { dg-require-effective-target ilp32 } */ +// { dg-options "-w" } +// prms-id: 784 + +//# 1 "GctSymbol.GctSymbol.CHMap.cc" +// This may look like C code, but it is really -*- C++ -*- +/* +Copyright (C) 1988, 2000, 2002 Free Software Foundation + written by Doug Lea (dl@rocky.oswego.edu) + +This file is part of the GNU C++ Library. This library is free +software; you can redistribute it and/or modify it under the terms of +the GNU Library General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your +option) any later version. This library is distributed in the hope +that it will be useful, but WITHOUT ANY WARRANTY; without even the +implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU Library General Public License for more details. +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + + +//#pragma implementation + +//# 1 "GctSymbol.GctSymbol.CHMap.h" 1 +// This may look like C code, but it is really -*- C++ -*- +/* +Copyright (C) 1988 Free Software Foundation + written by Doug Lea (dl@rocky.oswego.edu) + +This file is part of the GNU C++ Library. This library is free +software; you can redistribute it and/or modify it under the terms of +the GNU Library General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your +option) any later version. This library is distributed in the hope +that it will be useful, but WITHOUT ANY WARRANTY; without even the +implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU Library General Public License for more details. +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + + + + +//#pragma interface + + + +//# 1 "GctSymbol.GctSymbol.Map.h" 1 +// This may look like C code, but it is really -*- C++ -*- +/* +Copyright (C) 1988 Free Software Foundation + written by Doug Lea (dl@rocky.oswego.edu) + +This file is part of the GNU C++ Library. This library is free +software; you can redistribute it and/or modify it under the terms of +the GNU Library General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your +option) any later version. This library is distributed in the hope +that it will be useful, but WITHOUT ANY WARRANTY; without even the +implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU Library General Public License for more details. +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + + + + +//#pragma interface + + + +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/Pix.h" 1 + + + +typedef void* Pix; + +//# 26 "GctSymbol.GctSymbol.Map.h" 2 + +//# 1 "GctSymbol.defs.h" 1 +// This may look like C code, but it is really -*- C++ -*- +/* +Copyright (C) 1988 Free Software Foundation + written by Doug Lea (dl@rocky.oswego.edu) + +This file is part of the GNU C++ Library. This library is free +software; you can redistribute it and/or modify it under the terms of +the GNU Library General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your +option) any later version. This library is distributed in the hope +that it will be useful, but WITHOUT ANY WARRANTY; without even the +implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU Library General Public License for more details. +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + + + + + + + +//# 1 "../../GctSymbol.h" 1 +// -*- C++ -*- + + + +// +// GctSymbol class +// +// Expects to be included by Gct.h +// +// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU) +// + + + + + +//#pragma interface + + + + + +//# 25 "../../GctSymbol.h" 2 + +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 1 +// This may look like C code, but it is really -*- C++ -*- +/* +Copyright (C) 1988 Free Software Foundation + written by Doug Lea (dl@rocky.oswego.edu) + +This file is part of the GNU C++ Library. This library is free +software; you can redistribute it and/or modify it under the terms of +the GNU Library General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your +option) any later version. This library is distributed in the hope +that it will be useful, but WITHOUT ANY WARRANTY; without even the +implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU Library General Public License for more details. +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + + + + +//#pragma interface + + + +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stream.h" 1 + + + +// Compatibility with old library. + + +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1 +// This is part of the iostream library, providing -*- C++ -*- input/output. +// Copyright (C) 1991 Per Bothner. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free +// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + + +//#pragma interface + + + + +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/streambuf.h" 1 +// This is part of the iostream library, providing -*- C++ -*- input/output. +// Copyright (C) 1991 Per Bothner. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free +// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + + + +//#pragma interface + + +/* KLUDGES!! */ +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 1 + + +extern "C" { + + + +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/mips/lib/gcc/decstatn/cygnus-1.96/include/stddef.h" 1 + + + + + + +/* This avoids lossage on Sunos but only if stdtypes.h comes first. + There's no way to win with the other order! Sun lossage. */ + +/* In case nobody has defined these types, but we aren't running under + GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and + __WCHAR_TYPE__ have reasonable values. This can happen if the + parts of GCC is compiled by an older compiler, that actually + include gstddef.h, such as collect2. */ + +/* Signed type of difference of two pointers. */ + + + + + + + + + + + + + + +typedef long int ptrdiff_t; + + + + + + +/* Unsigned type of `sizeof' something. */ + + + + + + + + + + + + + + +typedef unsigned int size_t; + + + + + + +/* Data type for wide chars. */ + + + + + + + + + + + + + + + + + + + + + + +/* A null pointer constant. */ + + + + +/* Offset of member MEMBER in a struct of type TYPE. */ + + + + + +//# 7 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 2 + + + + +} + +//# 25 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/streambuf.h" 2 + + + + + + + + + + + + + + + + +class ostream; class streambuf; + +typedef long streamoff, streampos; + +struct _ios_fields { // The data members of an ios. + streambuf *_strbuf; + ostream* _tie; + long _width; + unsigned long _flags; + char _fill; + unsigned char _state; + unsigned short _precision; +}; + + +enum state_value { _good = 0, _eof = 1, _fail = 2, _bad = 4 }; + + +class ios : public _ios_fields { + public: + enum io_state { goodbit=0, eofbit=1, failbit=2, badbit=4 }; + enum open_mode { + in=1, + out=2, + ate=4, + app=8, + trunc=16, + nocreate=32, + noreplace=64 }; + enum seek_dir { beg, cur, end}; + enum { skipws=01, left=02, right=04, internal=010, + dec=020, oct=040, hex=0100, + showbase=0200, showpoint=0400, uppercase=01000, showpos=02000, + scientific=04000, fixed=0100000, unitbuf=020000, stdio=040000, + dont_close=0x80000000 //Don't close streambuf when destroying stream + }; + + ostream* tie() { return _tie; } + ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; } + + // Methods to change the format state. + char fill() { return _fill; } + char fill(char newf) { char oldf = _fill; _fill = newf; return oldf; } + unsigned long flags() { return _flags; } + unsigned long flags(unsigned long new_val) { + unsigned long old_val = _flags; _flags = new_val; return old_val; } + unsigned short precision() { return _precision; } + unsigned short precision(int newp) { + unsigned short oldp = _precision; _precision = (unsigned short)newp; + return oldp; } + unsigned long setf(unsigned long val) { + unsigned long oldbits = _flags; + _flags |= val; return oldbits; } + unsigned long setf(unsigned long val, unsigned long mask) { + unsigned long oldbits = _flags; + _flags = (_flags & ~mask) | (val & mask); return oldbits; } + unsigned long unsetf(unsigned long mask) { + unsigned long oldbits = _flags & mask; + _flags &= ~mask; return oldbits; } + long width() { return _width; } + long width(long val) { long save = _width; _width = val; return save; } + + static const unsigned long basefield; + static const unsigned long adjustfield; + static const unsigned long floatfield; + + streambuf* rdbuf() { return _strbuf; } + void clear(int state = 0) { _state = state; } + int good() { return _state == 0; } + int eof() { return _state & ios::eofbit; } + int fail() { return _state & (ios::badbit|ios::failbit); } + int bad() { return _state & ios::badbit; } + int rdstate() { return _state; } + void set(int flag) { _state |= flag; } + operator void*() { return fail() ? (void*)0 : (void*)this; } + int operator!() { return fail(); } + + + void unset(state_value flag) { _state &= ~flag; } + void close(); + int is_open(); + int readable(); + int writable(); + + + protected: + ios(streambuf*sb) { _strbuf=sb; _state=0; _width=0; _fill=' '; + _flags=ios::skipws; _precision=6; } +}; + + + + +typedef ios::seek_dir _seek_dir; + + +// Magic numbers and bits for the _flags field. +// The magic numbers use the high-order bits of _flags; +// the remaining bits are abailable for variable flags. +// Note: The magic numbers must all be negative if stdio +// emulation is desired. + + + + + + + + + + + + + + + +struct __streambuf { + // NOTE: If this is changed, also change __FILE in stdio/stdio.h! + int _flags; /* High-order word is _IO_MAGIC; rest is flags. */ + char* _gptr; /* Current get pointer */ + char* _egptr; /* End of get area. */ + char* _eback; /* Start of putback+get area. */ + char* _pbase; /* Start of put area. */ + char* _pptr; /* Current put pointer. */ + char* _epptr; /* End of put area. */ + char* _base; /* Start of reserve area. */ + char* _ebuf; /* End of reserve area. */ + struct streambuf *_chain; +}; + +struct streambuf : private __streambuf { + friend class ios; + friend class istream; + friend class ostream; + protected: + static streambuf* _list_all; /* List of open streambufs. */ + streambuf*& xchain() { return _chain; } + void _un_link(); + void _link_in(); + char* gptr() const { return _gptr; } + char* pptr() const { return _pptr; } + char* egptr() const { return _egptr; } + char* epptr() const { return _epptr; } + char* pbase() const { return _pbase; } + char* eback() const { return _eback; } + char* ebuf() const { return _ebuf; } + char* base() const { return _base; } + void xput_char(char c) { *_pptr++ = c; } + int xflags() { return _flags; } + int xflags(int f) { int fl = _flags; _flags = f; return fl; } + void xsetflags(int f) { _flags |= f; } + void gbump(int n) { _gptr += n; } + void pbump(int n) { _pptr += n; } + void setb(char* b, char* eb, int a=0); + void setp(char* p, char* ep) { _pbase=_pptr=p; _epptr=ep; } + void setg(char* eb, char* g, char *eg) { _eback=eb; _gptr=g; _egptr=eg; } + public: + static int flush_all(); + static void flush_all_linebuffered(); // Flush all line buffered files. + virtual int underflow(); // Leave public for now + virtual int overflow(int c = (-1) ); // Leave public for now + virtual int doallocate(); + virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); + virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out); + int sputbackc(char c); + int sungetc(); + streambuf(); + virtual ~streambuf(); + int unbuffered() { return _flags & 2 ? 1 : 0; } + int linebuffered() { return _flags & 0x4000 ? 1 : 0; } + void unbuffered(int i) + { if (i) _flags |= 2 ; else _flags &= ~2 ; } + void linebuffered(int i) + { if (i) _flags |= 0x4000 ; else _flags &= ~0x4000 ; } + int allocate() { + if (base() || unbuffered()) return 0; + else return doallocate(); } + virtual int sync(); + virtual int pbackfail(int c); + virtual int ungetfail(); + virtual streambuf* setbuf(char* p, int len); + int in_avail() { return _egptr - _gptr; } + int out_waiting() { return _pptr - _pbase; } + virtual int sputn(const char* s, int n); + virtual int sgetn(char* s, int n); + long sgetline(char* buf, size_t n, char delim, int putback_delim); + int sbumpc() { + if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ; + else return *(unsigned char*)_gptr++; } + int sgetc() { + if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ; + else return *(unsigned char*)_gptr; } + int snextc() { + if (++_gptr >= _egptr && underflow() == (-1) ) return (-1) ; + else return *(unsigned char*)_gptr; } + int sputc(int c) { + if (_pptr >= _epptr) return overflow(c); + return *_pptr++ = c, (unsigned char)c; } + int vscan(char const *fmt0, char* ap); + int vform(char const *fmt0, char* ap); +}; + +struct __file_fields { + char _fake; + char _shortbuf[1]; + short _fileno; + int _blksize; + char* _save_gptr; + char* _save_egptr; + long _offset; +}; + +class filebuf : public streambuf { + struct __file_fields _fb; + void init(); + public: + filebuf(); + filebuf(int fd); + filebuf(int fd, char* p, int len); + ~filebuf(); + filebuf* attach(int fd); + filebuf* open(const char *filename, const char *mode); + filebuf* open(const char *filename, int mode, int prot = 0664); + virtual int underflow(); + virtual int overflow(int c = (-1) ); + int is_open() { return _fb._fileno >= 0; } + int fd() { return is_open() ? _fb._fileno : (-1) ; } + filebuf* close(); + virtual int doallocate(); + virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); + int sputn(const char* s, int n); + int sgetn(char* s, int n); + protected: // See documentation in filebuf.C. + virtual int pbackfail(int c); + virtual int sync(); + int is_reading() { return eback() != egptr(); } + char* cur_ptr() { return is_reading() ? gptr() : pptr(); } + /* System's idea of pointer */ + char* file_ptr() { return _fb._save_gptr ? _fb._save_egptr : egptr(); } + int do_flush(); + // Low-level operations (Usually invoke system calls.) + virtual int sys_read(char* buf, size_t size); + virtual long sys_seek(long , _seek_dir); + virtual long sys_write(const void*, long); + virtual int sys_stat(void*); // Actually, a (struct stat*) + virtual int sys_close(); +}; + + +inline int ios::readable() { return rdbuf()->_flags & 4 ; } +inline int ios::writable() { return rdbuf()->_flags & 8 ; } +inline int ios::is_open() {return rdbuf()->_flags & 4 +8 ;} + + + + +//# 25 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 2 + + +class istream; class ostream; +typedef istream& (*__imanip)(istream&); +typedef ostream& (*__omanip)(ostream&); + +extern istream& ws(istream& ins); +extern ostream& flush(ostream& outs); +extern ostream& endl(ostream& outs); +extern ostream& ends(ostream& outs); + +class ostream : public ios +{ + void do_osfx(); + public: + ostream(); + ostream(streambuf* sb, ostream* tied=(__null) ); + ~ostream(); + + int opfx() { if (!good()) return 0; if (_tie) _tie->flush(); return 1; } + void osfx() { if (flags() & (ios::unitbuf|ios::stdio)) + do_osfx(); } + streambuf* ostreambuf() const { return _strbuf; } + ostream& flush(); + ostream& put(char c); + ostream& write(const char *s, int n); + ostream& write(const unsigned char *s, int n) { return write((char*)s, n);} + ostream& write(const void *s, int n) { return write((char*)s, n);} + ostream& seekp(streampos); + ostream& seekp(streamoff, _seek_dir); + streampos tellp(); + ostream& form(const char *format ...); + ostream& vform(const char *format, char* args); +}; + +ostream& operator<<(ostream&, char c); +ostream& operator<<(ostream& os, unsigned char c) { return os << (char)c; } +//ostream& operator<<(ostream &os, signed char c) { return os << (char)c; } +extern ostream& operator<<(ostream&, const char *s); +inline ostream& operator<<(ostream& os, const unsigned char *s) +{ return os << (const char*)s; } +//inline ostream& operator<<(ostream& os, const signed char *s) +//{ return os << (const char*)s; } +ostream& operator<<(ostream&, void *p); +ostream& operator<<(ostream&, int n); +ostream& operator<<(ostream&, long n); +ostream& operator<<(ostream&, unsigned int n); +ostream& operator<<(ostream&, unsigned long n); +ostream& operator<<(ostream& os, short n) {return os << (int)n;} +ostream& operator<<(ostream& os, unsigned short n) +{return os << (unsigned int)n;} +ostream& operator<<(ostream&, float n); +ostream& operator<<(ostream&, double n); +ostream& operator<<(ostream& os, __omanip func) { return (*func)(os); } +ostream& operator<<(ostream&, streambuf*); + +class istream : public ios +{ + size_t _gcount; + public: + istream(); + istream(streambuf* sb, ostream*tied=(__null) ); + ~istream(); + streambuf* istreambuf() const { return _strbuf; } + istream& get(char& c); + istream& get(unsigned char& c); + istream& read(char *ptr, int n); + istream& read(unsigned char *ptr, int n) { return read((char*)ptr, n); } + istream& read(void *ptr, int n) { return read((char*)ptr, n); } + int get() { return _strbuf->sbumpc(); } + istream& getline(char* ptr, int len, char delim = '\n'); + istream& get(char* ptr, int len, char delim = '\n'); + istream& gets(char **s, char delim = '\n'); + int ipfx(int need) { + if (!good()) { set(ios::failbit); return 0; } + if (_tie && (need == 0 || rdbuf()->in_avail())) ; //??? THIS LINE IS QUESTIONABLE */ + if (!need && (flags() & ios::skipws) && !ws(*this)) return 0; + return 1; + } + int ipfx0() { // Optimized version of ipfx(0). + if (!good()) { set(ios::failbit); return 0; } + if (_tie) _tie->flush(); + if ((flags() & ios::skipws) && !ws(*this)) return 0; + return 1; + } + int ipfx1() { // Optimized version of ipfx(1). + if (!good()) { set(ios::failbit); return 0; } + if (_tie && rdbuf()->in_avail() == 0) _tie->flush(); + return 1; + } + size_t gcount() { return _gcount; } + istream& seekg(streampos); + istream& seekg(streamoff, _seek_dir); + streampos tellg(); + istream& putback(char ch) { + if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit); + return *this;} + istream& unget() { + if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit); + return *this;} + + istream& unget(char ch) { return putback(ch); } + int skip(int i); + +}; + +istream& operator>>(istream&, char*); +istream& operator>>(istream& is, unsigned char* p) { return is >> (char*)p; } +//istream& operator>>(istream& is, signed char* p) { return is >> (char*)p; } +istream& operator>>(istream&, char& c); +istream& operator>>(istream&, unsigned char& c); +//istream& operator>>(istream&, signed char& c); +istream& operator>>(istream&, int&); +istream& operator>>(istream&, long&); +istream& operator>>(istream&, short&); +istream& operator>>(istream&, unsigned int&); +istream& operator>>(istream&, unsigned long&); +istream& operator>>(istream&, unsigned short&); +istream& operator>>(istream&, float&); +istream& operator>>(istream&, double&); +istream& operator>>(istream& is, __imanip func) { return (*func)(is); } + +class iostream : public ios { + size_t _gcount; + public: + iostream(); + operator istream&() { return *(istream*)this; } + operator ostream&() { return *(ostream*)this; } + ~iostream(); + // NOTE: These duplicate istream methods. + istream& get(char& c) { return ((istream*)this)->get(c); } + istream& get(unsigned char& c) { return ((istream*)this)->get(c); } + istream& read(char *ptr, int n) { return ((istream*)this)->read(ptr, n); } + istream& read(unsigned char *ptr, int n) + { return ((istream*)this)->read((char*)ptr, n); } + istream& read(void *ptr, int n) + { return ((istream*)this)->read((char*)ptr, n); } + int get() { return _strbuf->sbumpc(); } + istream& getline(char* ptr, int len, char delim = '\n') + { return ((istream*)this)->getline(ptr, len, delim); } + istream& get(char* ptr, int len, char delim = '\n') + { return ((istream*)this)->get(ptr, len, delim); } + istream& gets(char **s, char delim = '\n') + { return ((istream*)this)->gets(s, delim); } + int ipfx(int need) { return ((istream*)this)->ipfx(need); } + int ipfx0() { return ((istream*)this)->ipfx0(); } + int ipfx1() { return ((istream*)this)->ipfx1(); } + size_t gcount() { return _gcount; } + istream& putback(char ch) { return ((istream*)this)->putback(ch); } + istream& unget() { return ((istream*)this)->unget(); } + istream& seekg(streampos pos) { return ((istream*)this)->seekg(pos); } + istream& seekg(streamoff off, _seek_dir dir) + { return ((istream*)this)->seekg(off, dir); } + streampos tellg() { return ((istream*)this)->tellg(); } + + istream& unget(char ch) { return putback(ch); } + + + // NOTE: These duplicate ostream methods. + int opfx() { return ((ostream*)this)->opfx(); } + void osfx() { ((ostream*)this)->osfx(); } + ostream& flush() { return ((ostream*)this)->flush(); } + ostream& put(char c) { return ((ostream*)this)->put(c); } + ostream& write(const char *s, int n) + { return ((ostream*)this)->write(s, n); } + ostream& write(const unsigned char *s, int n) + { return ((ostream*)this)->write((char*)s, n); } + ostream& write(const void *s, int n) + { return ((ostream*)this)->write((char*)s, n); } + ostream& form(const char *format ...); + ostream& vform(const char *format, char* args) + { return ((ostream*)this)->vform(format, args); } + ostream& seekp(streampos pos) { return ((ostream*)this)->seekp(pos); } + ostream& seekp(streamoff off, _seek_dir dir) + { return ((ostream*)this)->seekp(off, dir); } + streampos tellp() { return ((ostream*)this)->tellp(); } +}; + +extern istream cin; +extern ostream cout, cerr, clog; // clog->rdbuf() == cerr->rdbuf() + +inline ostream& ostream::put(char c) { _strbuf->sputc(c); return *this; } + +struct Iostream_init { } ; // Compatibility hack for AT&T libraray. + + +//# 7 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stream.h" 2 + + +extern char* form(char*, ...); + +extern char* dec(long, int=0); +extern char* dec(int, int=0); +extern char* dec(unsigned long, int=0); +extern char* dec(unsigned int, int=0); + +extern char* hex(long, int=0); +extern char* hex(int, int=0); +extern char* hex(unsigned long, int=0); +extern char* hex(unsigned int, int=0); + +extern char* oct(long, int=0); +extern char* oct(int, int=0); +extern char* oct(unsigned long, int=0); +extern char* oct(unsigned int, int=0); + +inline istream& WS(istream& str) { return ws(str); } + + +//# 26 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 2 + +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/Regex.h" 1 +// This may look like C code, but it is really -*- C++ -*- +/* +Copyright (C) 1988 Free Software Foundation + written by Doug Lea (dl@rocky.oswego.edu) + +This file is part of the GNU C++ Library. This library is free +software; you can redistribute it and/or modify it under the terms of +the GNU Library General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your +option) any later version. This library is distributed in the hope +that it will be useful, but WITHOUT ANY WARRANTY; without even the +implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU Library General Public License for more details. +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + + + + +//#pragma interface + + + + + + + + + +struct re_pattern_buffer; // defined elsewhere +struct re_registers; + +class Regex +{ +private: + + Regex(const Regex&) {} // no X(X&) + void operator = (const Regex&) {} // no assignment + +protected: + re_pattern_buffer* buf; + re_registers* reg; + +public: + Regex(const char* t, + int fast = 0, + int bufsize = 40, + const char* transtable = 0); + + ~Regex(); + + int match(const char* s, int len, int pos = 0) const; + int search(const char* s, int len, + int& matchlen, int startpos = 0) const; + int match_info(int& start, int& length, int nth = 0) const; + + int OK() const; // representation invariant +}; + +// some built in regular expressions + +extern const Regex RXwhite; // = "[ \n\t\r\v\f]+" +extern const Regex RXint; // = "-?[0-9]+" +extern const Regex RXdouble; // = "-?\\(\\([0-9]+\\.[0-9]*\\)\\| + // \\([0-9]+\\)\\|\\(\\.[0-9]+\\)\\) + // \\([eE][---+]?[0-9]+\\)?" +extern const Regex RXalpha; // = "[A-Za-z]+" +extern const Regex RXlowercase; // = "[a-z]+" +extern const Regex RXuppercase; // = "[A-Z]+" +extern const Regex RXalphanum; // = "[0-9A-Za-z]+" +extern const Regex RXidentifier; // = "[A-Za-z_][A-Za-z0-9_]*" + + + +//# 27 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 2 + + +struct StrRep // internal String representations +{ + unsigned short len; // string length + unsigned short sz; // allocated space + char s[1]; // the string starts here + // (at least 1 char for trailing null) + // allocated & expanded via non-public fcts +}; + +// primitive ops on StrReps -- nearly all String fns go through these. + +StrRep* Salloc(StrRep*, const char*, int, int); +StrRep* Scopy(StrRep*, StrRep*); +StrRep* Sresize(StrRep*, int); +StrRep* Scat(StrRep*, const char*, int, const char*, int); +StrRep* Scat(StrRep*, const char*, int,const char*,int, const char*,int); +StrRep* Sprepend(StrRep*, const char*, int); +StrRep* Sreverse(StrRep*, StrRep*); +StrRep* Supcase(StrRep*, StrRep*); +StrRep* Sdowncase(StrRep*, StrRep*); +StrRep* Scapitalize(StrRep*, StrRep*); + +// These classes need to be defined in the order given + +class String; +class SubString; + +class SubString +{ + friend class String; +protected: + + String& S; // The String I'm a substring of + unsigned short pos; // starting position in S's rep + unsigned short len; // length of substring + + void assign(StrRep*, const char*, int = -1); + SubString(String& x, int p, int l); + SubString(const SubString& x); + +public: + +// Note there are no public constructors. SubStrings are always +// created via String operations + + ~SubString(); + + void operator = (const String& y); + void operator = (const SubString& y); + void operator = (const char* t); + void operator = (char c); + +// return 1 if target appears anywhere in SubString; else 0 + + int contains(char c) const; + int contains(const String& y) const; + int contains(const SubString& y) const; + int contains(const char* t) const; + int contains(const Regex& r) const; + +// return 1 if target matches entire SubString + + int matches(const Regex& r) const; + +// IO + + friend ostream& operator<<(ostream& s, const SubString& x); + +// status + + unsigned int length() const; + int empty() const; + const char* chars() const; + + int OK() const; + +}; + + +class String +{ + friend class SubString; + +protected: + StrRep* rep; // Strings are pointers to their representations + +// some helper functions + + int search(int, int, const char*, int = -1) const; + int search(int, int, char) const; + int match(int, int, int, const char*, int = -1) const; + int _gsub(const char*, int, const char* ,int); + int _gsub(const Regex&, const char*, int); + SubString _substr(int, int); + +public: + +// constructors & assignment + + String(); + String(const String& x); + String(const SubString& x); + String(const char* t); + String(const char* t, int len); + String(char c); + + ~String(); + + void operator = (const String& y); + void operator = (const char* y); + void operator = (char c); + void operator = (const SubString& y); + +// concatenation + + void operator += (const String& y); + void operator += (const SubString& y); + void operator += (const char* t); + void operator += (char c); + + void prepend(const String& y); + void prepend(const SubString& y); + void prepend(const char* t); + void prepend(char c); + + +// procedural versions: +// concatenate first 2 args, store result in last arg + + friend void cat(const String&, const String&, String&); + friend void cat(const String&, const SubString&, String&); + friend void cat(const String&, const char*, String&); + friend void cat(const String&, char, String&); + + friend void cat(const SubString&, const String&, String&); + friend void cat(const SubString&, const SubString&, String&); + friend void cat(const SubString&, const char*, String&); + friend void cat(const SubString&, char, String&); + + friend void cat(const char*, const String&, String&); + friend void cat(const char*, const SubString&, String&); + friend void cat(const char*, const char*, String&); + friend void cat(const char*, char, String&); + +// double concatenation, by request. (yes, there are too many versions, +// but if one is supported, then the others should be too...) +// Concatenate first 3 args, store in last arg + + friend void cat(const String&,const String&, const String&,String&); + friend void cat(const String&,const String&,const SubString&,String&); + friend void cat(const String&,const String&, const char*, String&); + friend void cat(const String&,const String&, char, String&); + friend void cat(const String&,const SubString&,const String&,String&); + friend void cat(const String&,const SubString&,const SubString&,String&); + friend void cat(const String&,const SubString&, const char*, String&); + friend void cat(const String&,const SubString&, char, String&); + friend void cat(const String&,const char*, const String&, String&); + friend void cat(const String&,const char*, const SubString&, String&); + friend void cat(const String&,const char*, const char*, String&); + friend void cat(const String&,const char*, char, String&); + + friend void cat(const char*, const String&, const String&,String&); + friend void cat(const char*,const String&,const SubString&,String&); + friend void cat(const char*,const String&, const char*, String&); + friend void cat(const char*,const String&, char, String&); + friend void cat(const char*,const SubString&,const String&,String&); + friend void cat(const char*,const SubString&,const SubString&,String&); + friend void cat(const char*,const SubString&, const char*, String&); + friend void cat(const char*,const SubString&, char, String&); + friend void cat(const char*,const char*, const String&, String&); + friend void cat(const char*,const char*, const SubString&, String&); + friend void cat(const char*,const char*, const char*, String&); + friend void cat(const char*,const char*, char, String&); + + +// searching & matching + +// return position of target in string or -1 for failure + + int index(char c, int startpos = 0) const; + int index(const String& y, int startpos = 0) const; + int index(const SubString& y, int startpos = 0) const; + int index(const char* t, int startpos = 0) const; + int index(const Regex& r, int startpos = 0) const; + +// return 1 if target appears anyhere in String; else 0 + + int contains(char c) const; + int contains(const String& y) const; + int contains(const SubString& y) const; + int contains(const char* t) const; + int contains(const Regex& r) const; + +// return 1 if target appears anywhere after position pos +// (or before, if pos is negative) in String; else 0 + + int contains(char c, int pos) const; + int contains(const String& y, int pos) const; + int contains(const SubString& y, int pos) const; + int contains(const char* t, int pos) const; + int contains(const Regex& r, int pos) const; + +// return 1 if target appears at position pos in String; else 0 + + int matches(char c, int pos = 0) const; + int matches(const String& y, int pos = 0) const; + int matches(const SubString& y, int pos = 0) const; + int matches(const char* t, int pos = 0) const; + int matches(const Regex& r, int pos = 0) const; + +// return number of occurences of target in String + + int freq(char c) const; + int freq(const String& y) const; + int freq(const SubString& y) const; + int freq(const char* t) const; + +// SubString extraction + +// Note that you can't take a substring of a const String, since +// this leaves open the possiblility of indirectly modifying the +// String through the SubString + + SubString at(int pos, int len); + SubString operator () (int pos, int len); // synonym for at + + SubString at(const String& x, int startpos = 0); + SubString at(const SubString& x, int startpos = 0); + SubString at(const char* t, int startpos = 0); + SubString at(char c, int startpos = 0); + SubString at(const Regex& r, int startpos = 0); + + SubString before(int pos); + SubString before(const String& x, int startpos = 0); + SubString before(const SubString& x, int startpos = 0); + SubString before(const char* t, int startpos = 0); + SubString before(char c, int startpos = 0); + SubString before(const Regex& r, int startpos = 0); + + SubString through(int pos); + SubString through(const String& x, int startpos = 0); + SubString through(const SubString& x, int startpos = 0); + SubString through(const char* t, int startpos = 0); + SubString through(char c, int startpos = 0); + SubString through(const Regex& r, int startpos = 0); + + SubString from(int pos); + SubString from(const String& x, int startpos = 0); + SubString from(const SubString& x, int startpos = 0); + SubString from(const char* t, int startpos = 0); + SubString from(char c, int startpos = 0); + SubString from(const Regex& r, int startpos = 0); + + SubString after(int pos); + SubString after(const String& x, int startpos = 0); + SubString after(const SubString& x, int startpos = 0); + SubString after(const char* t, int startpos = 0); + SubString after(char c, int startpos = 0); + SubString after(const Regex& r, int startpos = 0); + + +// deletion + +// delete len chars starting at pos + void del(int pos, int len); + +// delete the first occurrence of target after startpos + + void del(const String& y, int startpos = 0); + void del(const SubString& y, int startpos = 0); + void del(const char* t, int startpos = 0); + void del(char c, int startpos = 0); + void del(const Regex& r, int startpos = 0); + +// global substitution: substitute all occurrences of pat with repl + + int gsub(const String& pat, const String& repl); + int gsub(const SubString& pat, const String& repl); + int gsub(const char* pat, const String& repl); + int gsub(const char* pat, const char* repl); + int gsub(const Regex& pat, const String& repl); + +// friends & utilities + +// split string into array res at separators; return number of elements + + friend int split(const String& x, String res[], int maxn, + const String& sep); + friend int split(const String& x, String res[], int maxn, + const Regex& sep); + + friend String common_prefix(const String& x, const String& y, + int startpos = 0); + friend String common_suffix(const String& x, const String& y, + int startpos = -1); + friend String replicate(char c, int n); + friend String replicate(const String& y, int n); + friend String join(String src[], int n, const String& sep); + +// simple builtin transformations + + friend String reverse(const String& x); + friend String upcase(const String& x); + friend String downcase(const String& x); + friend String capitalize(const String& x); + +// in-place versions of above + + void reverse(); + void upcase(); + void downcase(); + void capitalize(); + +// element extraction + + char& operator [] (int i); + char elem(int i) const; + char firstchar() const; + char lastchar() const; + +// conversion + + operator const char*() const; + const char* chars() const; + + +// IO + + friend ostream& operator<<(ostream& s, const String& x); + friend ostream& operator<<(ostream& s, const SubString& x); + friend istream& operator>>(istream& s, String& x); + + friend int readline(istream& s, String& x, + char terminator = '\n', + int discard_terminator = 1); + +// status + + unsigned int length() const; + int empty() const; + +// preallocate some space for String + void alloc(int newsize); + +// report current allocation (not length!) + + int allocation() const; + + + volatile void error(const char* msg) const; + + int OK() const; +}; + +typedef String StrTmp; // for backward compatibility + +// other externs + +int compare(const String& x, const String& y); +int compare(const String& x, const SubString& y); +int compare(const String& x, const char* y); +int compare(const SubString& x, const String& y); +int compare(const SubString& x, const SubString& y); +int compare(const SubString& x, const char* y); +int fcompare(const String& x, const String& y); // ignore case + +extern StrRep _nilStrRep; +extern String _nilString; + +// other inlines + +String operator + (const String& x, const String& y); +String operator + (const String& x, const SubString& y); +String operator + (const String& x, const char* y); +String operator + (const String& x, char y); +String operator + (const SubString& x, const String& y); +String operator + (const SubString& x, const SubString& y); +String operator + (const SubString& x, const char* y); +String operator + (const SubString& x, char y); +String operator + (const char* x, const String& y); +String operator + (const char* x, const SubString& y); + +int operator==(const String& x, const String& y); +int operator!=(const String& x, const String& y); +int operator> (const String& x, const String& y); +int operator>=(const String& x, const String& y); +int operator< (const String& x, const String& y); +int operator<=(const String& x, const String& y); +int operator==(const String& x, const SubString& y); +int operator!=(const String& x, const SubString& y); +int operator> (const String& x, const SubString& y); +int operator>=(const String& x, const SubString& y); +int operator< (const String& x, const SubString& y); +int operator<=(const String& x, const SubString& y); +int operator==(const String& x, const char* t); +int operator!=(const String& x, const char* t); +int operator> (const String& x, const char* t); +int operator>=(const String& x, const char* t); +int operator< (const String& x, const char* t); +int operator<=(const String& x, const char* t); +int operator==(const SubString& x, const String& y); +int operator!=(const SubString& x, const String& y); +int operator> (const SubString& x, const String& y); +int operator>=(const SubString& x, const String& y); +int operator< (const SubString& x, const String& y); +int operator<=(const SubString& x, const String& y); +int operator==(const SubString& x, const SubString& y); +int operator!=(const SubString& x, const SubString& y); +int operator> (const SubString& x, const SubString& y); +int operator>=(const SubString& x, const SubString& y); +int operator< (const SubString& x, const SubString& y); +int operator<=(const SubString& x, const SubString& y); +int operator==(const SubString& x, const char* t); +int operator!=(const SubString& x, const char* t); +int operator> (const SubString& x, const char* t); +int operator>=(const SubString& x, const char* t); +int operator< (const SubString& x, const char* t); +int operator<=(const SubString& x, const char* t); + + + + +// status reports, needed before defining other things + +inline unsigned int String::length() const { return rep->len; } +inline int String::empty() const { return rep->len == 0; } +inline const char* String::chars() const { return &(rep->s[0]); } +inline int String::allocation() const { return rep->sz; } +inline void String::alloc(int newsize) { rep = Sresize(rep, newsize); } + +inline unsigned int SubString::length() const { return len; } +inline int SubString::empty() const { return len == 0; } +inline const char* SubString::chars() const { return &(S.rep->s[pos]); } + + +// constructors + +inline String::String() + : rep(&_nilStrRep) {} +inline String::String(const String& x) + : rep(Scopy(0, x.rep)) {} +inline String::String(const char* t) + : rep(Salloc(0, t, -1, -1)) {} +inline String::String(const char* t, int tlen) + : rep(Salloc(0, t, tlen, tlen)) {} +inline String::String(const SubString& y) + : rep(Salloc(0, y.chars(), y.length(), y.length())) {} +inline String::String(char c) + : rep(Salloc(0, &c, 1, 1)) {} + +inline String::~String() { if (rep != &_nilStrRep) delete rep; } + +inline SubString::SubString(const SubString& x) + :S(x.S), pos(x.pos), len(x.len) {} +inline SubString::SubString(String& x, int first, int l) + :S(x), pos(first), len(l) {} + +inline SubString::~SubString() {} + +// assignment + +inline void String::operator = (const String& y) +{ + rep = Scopy(rep, y.rep); +} + +inline void String::operator=(const char* t) +{ + rep = Salloc(rep, t, -1, -1); +} + +inline void String::operator=(const SubString& y) +{ + rep = Salloc(rep, y.chars(), y.length(), y.length()); +} + +inline void String::operator=(char c) +{ + rep = Salloc(rep, &c, 1, 1); +} + + +inline void SubString::operator = (const char* ys) +{ + assign(0, ys); +} + +inline void SubString::operator = (char ch) +{ + assign(0, &ch, 1); +} + +inline void SubString::operator = (const String& y) +{ + assign(y.rep, y.chars(), y.length()); +} + +inline void SubString::operator = (const SubString& y) +{ + assign(y.S.rep, y.chars(), y.length()); +} + +// Zillions of cats... + +inline void cat(const String& x, const String& y, String& r) +{ + r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const String& x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const String& x, const char* y, String& r) +{ + r.rep = Scat(r.rep, x.chars(), x.length(), y, -1); +} + +inline void cat(const String& x, char y, String& r) +{ + r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1); +} + +inline void cat(const SubString& x, const String& y, String& r) +{ + r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const SubString& x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const SubString& x, const char* y, String& r) +{ + r.rep = Scat(r.rep, x.chars(), x.length(), y, -1); +} + +inline void cat(const SubString& x, char y, String& r) +{ + r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1); +} + +inline void cat(const char* x, const String& y, String& r) +{ + r.rep = Scat(r.rep, x, -1, y.chars(), y.length()); +} + +inline void cat(const char* x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, x, -1, y.chars(), y.length()); +} + +inline void cat(const char* x, const char* y, String& r) +{ + r.rep = Scat(r.rep, x, -1, y, -1); +} + +inline void cat(const char* x, char y, String& r) +{ + r.rep = Scat(r.rep, x, -1, &y, 1); +} + +inline void cat(const String& a, const String& x, const String& y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const String& a, const String& x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const String& a, const String& x, const char* y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1); +} + +inline void cat(const String& a, const String& x, char y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), &y, 1); +} + +inline void cat(const String& a, const SubString& x, const String& y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const String& a, const SubString& x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const String& a, const SubString& x, const char* y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1); +} + +inline void cat(const String& a, const SubString& x, char y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), &y, 1); +} + +inline void cat(const String& a, const char* x, const String& y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length()); +} + +inline void cat(const String& a, const char* x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length()); +} + +inline void cat(const String& a, const char* x, const char* y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y, -1); +} + +inline void cat(const String& a, const char* x, char y, String& r) +{ + r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, &y, 1); +} + + +inline void cat(const char* a, const String& x, const String& y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const char* a, const String& x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const char* a, const String& x, const char* y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1); +} + +inline void cat(const char* a, const String& x, char y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), &y, 1); +} + +inline void cat(const char* a, const SubString& x, const String& y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const char* a, const SubString& x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length()); +} + +inline void cat(const char* a, const SubString& x, const char* y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1); +} + +inline void cat(const char* a, const SubString& x, char y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), &y, 1); +} + +inline void cat(const char* a, const char* x, const String& y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length()); +} + +inline void cat(const char* a, const char* x, const SubString& y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length()); +} + +inline void cat(const char* a, const char* x, const char* y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x, -1, y, -1); +} + +inline void cat(const char* a, const char* x, char y, String& r) +{ + r.rep = Scat(r.rep, a, -1, x, -1, &y, 1); +} + + +// operator versions + +inline void String::operator +=(const String& y) +{ + cat(*this, y, *this); +} + +inline void String::operator +=(const SubString& y) +{ + cat(*this, y, *this); +} + +inline void String::operator += (const char* y) +{ + cat(*this, y, *this); +} + +inline void String:: operator +=(char y) +{ + cat(*this, y, *this); +} + +// constructive concatenation + + + +inline String operator + (const String& x, const String& y) return r; // { dg-error "" } +{ + cat(x, y, r); // { dg-error "" } +} + +inline String operator + (const String& x, const SubString& y) return r; // { dg-error "" } +{ + cat(x, y, r); // { dg-error "" } +} + +inline String operator + (const String& x, const char* y) return r; // { dg-error "" } +{ + cat(x, y, r); // { dg-error "" } +} + +inline String operator + (const String& x, char y) return r; // { dg-error "" } +{ + cat(x, y, r); // { dg-error "" } +} + +inline String operator + (const SubString& x, const String& y) return r; // { dg-error "" } +{ + cat(x, y, r); // { dg-error "" } +} + +inline String operator + (const SubString& x, const SubString& y) return r; // { dg-error "" } +{ + cat(x, y, r); // { dg-error "" } +} + +inline String operator + (const SubString& x, const char* y) return r; // { dg-error "" } +{ + cat(x, y, r); // { dg-error "" } +} + +inline String operator + (const SubString& x, char y) return r; // { dg-error "" } +{ + cat(x, y, r); // { dg-error "" } +} + +inline String operator + (const char* x, const String& y) return r; // { dg-error "" } +{ + cat(x, y, r); // { dg-error "" } +} + +inline String operator + (const char* x, const SubString& y) return r; // { dg-error "" } +{ + cat(x, y, r); // { dg-error "" } +} + +inline String reverse(const String& x) return r; // { dg-error "" } +{ + r.rep = Sreverse(x.rep, r.rep); // { dg-error "" } +} + +inline String upcase(const String& x) return r; // { dg-error "" } +{ + r.rep = Supcase(x.rep, r.rep); // { dg-error "" } +} + +inline String downcase(const String& x) return r; // { dg-error "" } +{ + r.rep = Sdowncase(x.rep, r.rep); // { dg-error "" } +} + +inline String capitalize(const String& x) return r; // { dg-error "" } +{ + r.rep = Scapitalize(x.rep, r.rep); // { dg-error "" } +} + +//# 883 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" + + +// prepend + +inline void String::prepend(const String& y) +{ + rep = Sprepend(rep, y.chars(), y.length()); +} + +inline void String::prepend(const char* y) +{ + rep = Sprepend(rep, y, -1); +} + +inline void String::prepend(char y) +{ + rep = Sprepend(rep, &y, 1); +} + +inline void String::prepend(const SubString& y) +{ + rep = Sprepend(rep, y.chars(), y.length()); +} + +// misc transformations + + +inline void String::reverse() +{ + rep = Sreverse(rep, rep); +} + + +inline void String::upcase() +{ + rep = Supcase(rep, rep); +} + + +inline void String::downcase() +{ + rep = Sdowncase(rep, rep); +} + + +inline void String::capitalize() +{ + rep = Scapitalize(rep, rep); +} + +// element extraction + +inline char& String::operator [] (int i) +{ + if (((unsigned)i) >= length()) error("invalid index"); + return rep->s[i]; +} + +inline char String::elem (int i) const +{ + if (((unsigned)i) >= length()) error("invalid index"); + return rep->s[i]; +} + +inline char String::firstchar() const +{ + return elem(0); +} + +inline char String::lastchar() const +{ + return elem(length() - 1); +} + +// searching + +inline int String::index(char c, int startpos) const +{ + return search(startpos, length(), c); +} + +inline int String::index(const char* t, int startpos) const +{ + return search(startpos, length(), t); +} + +inline int String::index(const String& y, int startpos) const +{ + return search(startpos, length(), y.chars(), y.length()); +} + +inline int String::index(const SubString& y, int startpos) const +{ + return search(startpos, length(), y.chars(), y.length()); +} + +inline int String::index(const Regex& r, int startpos) const +{ + int unused; return r.search(chars(), length(), unused, startpos); +} + +inline int String::contains(char c) const +{ + return search(0, length(), c) >= 0; +} + +inline int String::contains(const char* t) const +{ + return search(0, length(), t) >= 0; +} + +inline int String::contains(const String& y) const +{ + return search(0, length(), y.chars(), y.length()) >= 0; +} + +inline int String::contains(const SubString& y) const +{ + return search(0, length(), y.chars(), y.length()) >= 0; +} + +inline int String::contains(char c, int p) const +{ + return match(p, length(), 0, &c, 1) >= 0; +} + +inline int String::contains(const char* t, int p) const +{ + return match(p, length(), 0, t) >= 0; +} + +inline int String::contains(const String& y, int p) const +{ + return match(p, length(), 0, y.chars(), y.length()) >= 0; +} + +inline int String::contains(const SubString& y, int p) const +{ + return match(p, length(), 0, y.chars(), y.length()) >= 0; +} + +inline int String::contains(const Regex& r) const +{ + int unused; return r.search(chars(), length(), unused, 0) >= 0; +} + +inline int String::contains(const Regex& r, int p) const +{ + return r.match(chars(), length(), p) >= 0; +} + + +inline int String::matches(const SubString& y, int p) const +{ + return match(p, length(), 1, y.chars(), y.length()) >= 0; +} + +inline int String::matches(const String& y, int p) const +{ + return match(p, length(), 1, y.chars(), y.length()) >= 0; +} + +inline int String::matches(const char* t, int p) const +{ + return match(p, length(), 1, t) >= 0; +} + +inline int String::matches(char c, int p) const +{ + return match(p, length(), 1, &c, 1) >= 0; +} + +inline int String::matches(const Regex& r, int p) const +{ + int l = (p < 0)? -p : length() - p; + return r.match(chars(), length(), p) == l; +} + + +inline int SubString::contains(const char* t) const +{ + return S.search(pos, pos+len, t) >= 0; +} + +inline int SubString::contains(const String& y) const +{ + return S.search(pos, pos+len, y.chars(), y.length()) >= 0; +} + +inline int SubString::contains(const SubString& y) const +{ + return S.search(pos, pos+len, y.chars(), y.length()) >= 0; +} + +inline int SubString::contains(char c) const +{ + return S.search(pos, pos+len, 0, c) >= 0; +} + +inline int SubString::contains(const Regex& r) const +{ + int unused; return r.search(chars(), len, unused, 0) >= 0; +} + +inline int SubString::matches(const Regex& r) const +{ + return r.match(chars(), len, 0) == len; +} + + +inline int String::gsub(const String& pat, const String& r) +{ + return _gsub(pat.chars(), pat.length(), r.chars(), r.length()); +} + +inline int String::gsub(const SubString& pat, const String& r) +{ + return _gsub(pat.chars(), pat.length(), r.chars(), r.length()); +} + +inline int String::gsub(const Regex& pat, const String& r) +{ + return _gsub(pat, r.chars(), r.length()); +} + +inline int String::gsub(const char* pat, const String& r) +{ + return _gsub(pat, -1, r.chars(), r.length()); +} + +inline int String::gsub(const char* pat, const char* r) +{ + return _gsub(pat, -1, r, -1); +} + + + +inline ostream& operator<<(ostream& s, const String& x) +{ + s << x.chars(); return s; +} + +// a zillion comparison operators + +inline int operator==(const String& x, const String& y) +{ + return compare(x, y) == 0; +} + +inline int operator!=(const String& x, const String& y) +{ + return compare(x, y) != 0; +} + +inline int operator>(const String& x, const String& y) +{ + return compare(x, y) > 0; +} + +inline int operator>=(const String& x, const String& y) +{ + return compare(x, y) >= 0; +} + +inline int operator<(const String& x, const String& y) +{ + return compare(x, y) < 0; +} + +inline int operator<=(const String& x, const String& y) +{ + return compare(x, y) <= 0; +} + +inline int operator==(const String& x, const SubString& y) +{ + return compare(x, y) == 0; +} + +inline int operator!=(const String& x, const SubString& y) +{ + return compare(x, y) != 0; +} + +inline int operator>(const String& x, const SubString& y) +{ + return compare(x, y) > 0; +} + +inline int operator>=(const String& x, const SubString& y) +{ + return compare(x, y) >= 0; +} + +inline int operator<(const String& x, const SubString& y) +{ + return compare(x, y) < 0; +} + +inline int operator<=(const String& x, const SubString& y) +{ + return compare(x, y) <= 0; +} + +inline int operator==(const String& x, const char* t) +{ + return compare(x, t) == 0; +} + +inline int operator!=(const String& x, const char* t) +{ + return compare(x, t) != 0; +} + +inline int operator>(const String& x, const char* t) +{ + return compare(x, t) > 0; +} + +inline int operator>=(const String& x, const char* t) +{ + return compare(x, t) >= 0; +} + +inline int operator<(const String& x, const char* t) +{ + return compare(x, t) < 0; +} + +inline int operator<=(const String& x, const char* t) +{ + return compare(x, t) <= 0; +} + +inline int operator==(const SubString& x, const String& y) +{ + return compare(y, x) == 0; +} + +inline int operator!=(const SubString& x, const String& y) +{ + return compare(y, x) != 0; +} + +inline int operator>(const SubString& x, const String& y) +{ + return compare(y, x) < 0; +} + +inline int operator>=(const SubString& x, const String& y) +{ + return compare(y, x) <= 0; +} + +inline int operator<(const SubString& x, const String& y) +{ + return compare(y, x) > 0; +} + +inline int operator<=(const SubString& x, const String& y) +{ + return compare(y, x) >= 0; +} + +inline int operator==(const SubString& x, const SubString& y) +{ + return compare(x, y) == 0; +} + +inline int operator!=(const SubString& x, const SubString& y) +{ + return compare(x, y) != 0; +} + +inline int operator>(const SubString& x, const SubString& y) +{ + return compare(x, y) > 0; +} + +inline int operator>=(const SubString& x, const SubString& y) +{ + return compare(x, y) >= 0; +} + +inline int operator<(const SubString& x, const SubString& y) +{ + return compare(x, y) < 0; +} + +inline int operator<=(const SubString& x, const SubString& y) +{ + return compare(x, y) <= 0; +} + +inline int operator==(const SubString& x, const char* t) +{ + return compare(x, t) == 0; +} + +inline int operator!=(const SubString& x, const char* t) +{ + return compare(x, t) != 0; +} + +inline int operator>(const SubString& x, const char* t) +{ + return compare(x, t) > 0; +} + +inline int operator>=(const SubString& x, const char* t) +{ + return compare(x, t) >= 0; +} + +inline int operator<(const SubString& x, const char* t) +{ + return compare(x, t) < 0; +} + +inline int operator<=(const SubString& x, const char* t) +{ + return compare(x, t) <= 0; +} + + +// a helper needed by at, before, etc. + +inline SubString String::_substr(int first, int l) +{ + if (first >= length() ) // ??? THIS LINE IS QUESTIONABLE + return SubString(_nilString, 0, 0) ; + else + return SubString(*this, first, l); +} + + + + + +//# 26 "../../GctSymbol.h" 2 + + +//# 1 "../../../../../../mips/include/Gct/Object/GctHashObject.h" 1 +// -*- C++ -*- + + + +// +// GctHashObject class (is abstract) +// +// Expects to be included by Object.h or where needed explicitly. +// +// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU) +// + + + + + +//#pragma interface + + + +//# 1 "../../../../../../mips/include/Gct/Object/GctObject.h" 1 +// -*- C++ -*- + + + +// +// GctObject class (is abstract) +// +// Expects to be included by Object.h or where needed explicitly. +// +// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU) +// + + + + + +//#pragma interface + + + +//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1 +// -*- C++ -*- + + + +// +// tostrstream class +// +// A terminated oststream - an ostsrstream that auto-terminates on str() +// +// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU) +// + + + + + +//#pragma interface + + + +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/strstream.h" 1 +// This is part of the iostream library, providing input/output for C++. +// Copyright (C) 1991 Per Bothner. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free +// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + + + +//#pragma interface + +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1 +// This is part of the iostream library, providing -*- C++ -*- input/output. +// Copyright (C) 1991 Per Bothner. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free +// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" + +//# 23 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/strstream.h" 2 + + +class strstreambuf : public streambuf { + size_t *lenp; /* current (logical) length (i.e. valid data bytes) */ + size_t *sizep; /* allocated (physical) buffer size */ + char **bufp; + size_t _len; + size_t _size; + char *buf; + int _frozen; + protected: + virtual int overflow(int = (-1) ); + public: + strstreambuf(); + strstreambuf(int initial); + strstreambuf(char *ptr, int size, char *pstart = (__null) ); + ~strstreambuf(); + int frozen() { return _frozen; } + void freeze(int n=1) { _frozen = n != 0; } + size_t pcount(); + char *str(); +}; + +class istrstream : public istream { + public: + istrstream(char*); + istrstream(char*, int); + strstreambuf* rdbuf() { return (strstreambuf*)_strbuf; } +}; + +class ostrstream : public ostream { + public: + ostrstream(); + ostrstream(char *cp, int n, int mode=ios::out); + size_t pcount() { return ((strstreambuf*)_strbuf)->pcount(); } + char *str() { return ((strstreambuf*)_strbuf)->str(); } + void freeze(int n = 1) { ((strstreambuf*)_strbuf)->freeze(n); } + int frozen() { return ((strstreambuf*)_strbuf)->frozen(); } + strstreambuf* rdbuf() { return (strstreambuf*)_strbuf; } +}; + + +//# 25 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 2 + + +// +// tostrstream class +// +// An isteam class that doesn't have that nasty skipws parameter that +// you have to remember to set. This class simply provides the istream +// functionality with a set of constructors which defaults skipws to +// FALSE (instead of defaulting to TRUE as is the case with plain istream). +// +class tostrstream: public ostrstream { +public: + tostrstream(): ostrstream() + { } + // This constructor defines cp as the buffer to use for the + // stream (instead of one of its own devising); it does NOT + // initialize the ostrstream to contain cp (of length n). + tostrstream(char *cp, int n, int mode=ios::out): ostrtream(cp, n, mode) // { dg-error "" } + { } + char *str() + { + char *s = ostrstream::str(); + s[ostrstream::pcount()] = '\0'; + return s; + } +}; + + +//# 25 "../../../../../../mips/include/Gct/Object/GctObject.h" 2 + + +//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 1 +// -*- C++ -*- + + + +// +// GttObject class (is abstract) +// +// Expects to be included where needed explicitly. +// +// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU) +// + + + + + +//#pragma interface + + + +//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1 +// -*- C++ -*- +//# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" + +//# 25 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2 + + +//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 1 +// -*- C++ -*- + + + +// +// GttErrorHandler class +// +// Expects to be included by Gtt.h +// +// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU) +// + + + + + +//#pragma interface + + + +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1 + + + + + + + +//# 25 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2 + + +//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 1 +// -*- C++ -*- + + + +// +// Fake up a libstuff++ +// +// This is done as a complete and utter hack; this library has no function +// at all being in the boot area; it is here solely in order to provide a +// libstuff++ against which the Makefiles can resolve link lines. +// +// The only reason that this is done is to allow the STANDARD_C++_LIBRARIES +// as provided by the Makefile templates in the boot area to be the same +// ones that are used by the tools outside this hierarchy. +// +// The tools outside this hierarchy use a different libstuff++; one that is +// written in C++. This one is not written in C++ in order to be simpler. +// + + + + + +//#pragma interface + + + +extern "C" { +//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 1 + + + +/* + * Useful stuff + */ + +/* + */ + +//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/ansi.h" 1 + + + + +/* + * ANSI Compiler Support + * + * David Harrison + * University of California, Berkeley + * 1988 + * + * ANSI compatible compilers are supposed to define the preprocessor + * directive __STDC__. Based on this directive, this file defines + * certain ANSI specific macros. + * + * ARGS: + * Used in function prototypes. Example: + * extern int foo + * ARGS((char *blah, double threshold)); + */ + +/* + * + * Modifications + * Wendell C Baker + * University of California, Berkeley + */ + +/* Function prototypes */ + + + + + + + + + + + + + + + + + + + + + + + + + + + +//# 15 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 2 + + + +/* + * If g++, then we stub out part of this thing and let the C++ types take + * over and do the same job; some compatibility must be given however + */ + +/* + * Use the GNU libg++ definition + */ +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1 + + + + + + + +//# 26 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 2 + +//# 35 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" + + +/* + * Make various pieces of C code that use the old ``Boolean'' + * be compatible by faking up the definition of Boolean using + * the new bool type. + */ + + +//# 58 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" + + +typedef long FitAny; /* can fit any integral type */ + +/* + * typedef char *String; - DO NOT USE THIS - it conflicts with C++ + * typedef char **Stringv; - just use char* and char** instead. + * - void* can be used for arbitrary pointers + */ + + + + +extern int nocase_strcmp (char *, char *) ; +extern int nocase_strncmp (char *, char *, int) ; + +extern bool nocase_strequal (char *, char *) ; +extern bool nocase_strnequal (char *, char *, int) ; + +extern bool lead_strequal (char *, char *) ; +extern bool nocase_lead_strequal (char *, char *) ; + +extern int strhash (char *, int) ; +extern int nocase_strhash (char *, int) ; + +extern int sign (int) ; + +/* + * Some useful macros. + */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +//# 33 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2 + +} + +// +// This is here because we wish to provide externs for the two +// functions btoa(bool, unsigned = 0) and operator<<(ostream&, bool) +// because they are not provided in bool.h. +// +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1 + + + + + + + +//# 41 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2 + +extern const char *stringify(bool b); +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1 +// This is part of the iostream library, providing -*- C++ -*- input/output. +// Copyright (C) 1991 Per Bothner. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free +// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" + +//# 43 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2 + +extern ostream& operator<<(ostream&, bool); + +// Should this be kept separate? bool isn't, but then is +// included here only to define ostream& operator<<(ostream&, bool) +//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/unit.h" 1 +// -*- C++ -*- + + + +// +// unit enum +// +// Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU) +// + + +// +// unit enum +// +// This _looks_ silly, but it has an important theoretical basis in category +// theory. For the pragmatic reason for its existence, see the example below. +// +enum unit { + UNIT = 1, +}; + +extern const char *stringify(unit u); + +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1 +// This is part of the iostream library, providing -*- C++ -*- input/output. +// Copyright (C) 1991 Per Bothner. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free +// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" + +//# 28 "/sandbox/wbaker/wbaker0/source/mips/include/unit.h" 2 + +extern ostream& operator<<(ostream&, unit); + +// +// A unit is used in cases where the type signature of an overloaded +// function must be differentiated in some stronger way than can be +// denoted unambiguously in the C++ syntax. This enum is used to give +// one of the functions a different type signature, thereby allowing +// the overloading. +// +// The use of ``unit'' instead of int or bool is important because a unit +// has only one possible value; therefore it adds no more information to +// the code. For example, say a bool was used instead, then in the testing +// phase, would have to ask: what if TRUE was given, what if FALSE was given. +// The problem is compounded if char or int is used. +// +// Example: +// +// class ID { +// public: +// ID(); // construct a null ID +// ID(unit); // alloc a ID with a new id +// private: +// static unsigned high_water; +// unsigned id; +// }; +// +// Try working this example save that ID implements all of the generic +// features of the identifier object, but the high_water is stored +// in the heir. That is what originally motivated the creation of unit. +// + + +//# 48 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2 + + +// +// In the spirit of the standard GNU error handler functions +// as described in +// typedef void (*one_arg_error_handler_t)(const char*); +// a one argument error handler function pointer +// typedef void (*two_arg_error_handler_t)(const char*, const char*); +// a two argument error handler function pointer +// +// And now the NEW +// +// typedef void (*zero_arg_error_handler_t)(); +// a zero argument error handler function pointer +// +typedef void (*zero_arg_error_handler_t)(); + +// +// In the spirit of the default GNU error handler functions +// as described in +// extern void default_one_arg_error_handler(const char *message); +// print out message on stderr, and do the default thing (abort) +// extern void default_two_arg_error_handler(const char *kind, const char *message); +// print out kind and message on stderr, and do the default thing (abort) +// +// And now the NEW +// +// extern void default_zero_arg_error_handler(const char *message); +// do the default thing (abort) +// +extern void default_zero_arg_error_handler(); + +// Guaranteed to exit (1) +extern void exit_zero_arg_error_handler(); +extern void exit_one_arg_error_handler(const char *message); +extern void exit_two_arg_error_handler(const char *kind, const char *message); + +// Guaranteed to abort() +extern void abort_zero_arg_error_handler(); +extern void abort_one_arg_error_handler(const char *message); +extern void abort_two_arg_error_handler(const char *kind, const char *message); + +// +// In the spirit of the standard GNU error handlers +// as described in +// extern void verbose_File_error_handler(const char*); +// perror and set errno = 0 +// extern void quiet_File_error_handler(const char*); +// set errno = 0 +// extern void fatal_File_error_handler(const char*); +// perror and exit 1 +// +// And now the NEW +// +// extern void preserve_File_error_handler(const char *message); +// no perror, no assignment to errno. +// +extern void preserve_File_error_handler(const char *message); + + +//# 27 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2 + +//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1 +// -*- C++ -*- +//# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" + +//# 28 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2 + + +// +// It is expected that this will be virtually multiply inherited +// into all of the classes that need error reporting services. +// +// The typical way to have that done is by inheriting the GttObject +// as a virtual base class. +// + +// +// GttErrorHandler class +// +class GttErrorHandler { +public: + GttErrorHandler(); + GttErrorHandler(const char *program); + virtual ~GttErrorHandler(); + + // + // Error messages + // - an unacceptable, but expected and recoverable condition + // was detected (but the test fails) + // - errors are for ``the expected environment was not found'' + // rather than for ``file couldn't be opened'' + // - these messages cannot be shut off + // - the error handler determines the recovery action + // TODO - one day exceptions will be used here + // + static void error(const char *message); + static void error(tostrstream& message); + + static void error(const char *function, const char *message); + static void error(const char *function, tostrstream& message); + + static void error(const char *class_name, const char *method, const char *message); + static void error(const char *class_name, const char *method, tostrstream& message); + + // + // Fatal messages + // - an unacceptable and unexpected error was detected + // the data invariants were violated, there is no recovery + // - these messages cannot be shut off + // - the error handler determines the recovery action + // TODO - one day exceptions will be used here + // + static void fatal(const char *message); + static void fatal(tostrstream& message); + + static void fatal(const char *function, const char *message); + static void fatal(const char *function, tostrstream& message); + + static void fatal(const char *class_name, const char *method, const char *message); + static void fatal(const char *class_name, const char *method, tostrstream& message); +private: + // + // Two underscores are used here in order to prevent confusion of these + // private variables with any of the heir's private variables. Note that + // access control is different than visibility in C++, so all the variable + // names in a class hierarchy must be unique. + // + + static bool __partial_init; + static void __partial_initialize(); + static bool __full_init; + static void __full_initialize(const char *program); + static char *__program; + + static void __handle_error(); + static void __handle_fatal(); + static void __add_newline(const char *message); + + static bool __output_valid(); + static ostream *__output; +}; + + +//# 27 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2 + + +// +// GttObject class (is abstract) +// +class GttObject: virtual public GttErrorHandler { +protected: + GttObject(); + GttObject(const GttObject&); + virtual ~GttObject(); // ensure descendants have virtual destructors + +public: + // + // I/O Support + // + // The value typically persists only long enough for an i/o operation + // to be performed (see the defintion of output via operator<<(... ) below) + virtual const char *stringify(); +protected: + // This is the buffer into which the printed representation of this + // object will be put when the time comes. It is associated with the + // object so it will never go away (so long as the object exists). + // Use a pointer so that you only pay for the space when I/O is used + tostrstream *stringbuf; + void clear_stringbuf(); + +public: + // + // Consistency + // + // The global data invariant for the whole object (heirs included). + // This OK function will call the local invariant function ok() if + // necessary and in addition the OK functions of the heirs + // This is expected to compute the data invariant of the object. + // It will execute GctErrorHandler::fatal if there is wrong. + virtual void OK() const; + +protected: + // + // consistency + // + // This function computes the invariant which is local to this object. + // It does not call any of the ancestor's OK() or ok() functions. + // It is not a virtual function so that it can be called from within a + // constructor with impunity. Thus this function MUST NOT call any + // virtual functions either; it should call them by their full name if + // that is necessary. The global OK() function will call this function + // as necessary. + // + // This function must NOT NEVER EVER be made virtual. + void ok() const; + +protected: + // + // Class Name + // + // This must return a static (constant) string which is the name + // of the class being declared. By convention, not all classes + // must have one of these, but the major root abstract class must + // have one in order to allow the stringify() to work approximately + // correctly. + virtual const char *class_name() const = 0; +}; + +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1 +// This is part of the iostream library, providing -*- C++ -*- input/output. +// Copyright (C) 1991 Per Bothner. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free +// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" + +//# 91 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2 + +extern ostream& operator<<(ostream&, GttObject&); + +// There may be other X& operator<<(X&, GttObject&) defined in the +// packages defining class X. For example see the definition of +// GttUnitObject& operator<<(GttUnitObject&, GttObject&) in Unit. + + +//# 27 "../../../../../../mips/include/Gct/Object/GctObject.h" 2 + + +//# 1 "../../../../../../mips/include/Gct/GctErrorHandler.h" 1 +// -*- C++ -*- + + + +// +// GctErrorHandler class +// +// Expects to be included by Gct.h +// +// Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU) +// + + + + + +//#pragma interface + + + +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1 + + + + + + + +//# 25 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2 + +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 1 +// This may look like C code, but it is really -*- C++ -*- +/* +Copyright (C) 1988 Free Software Foundation + written by Doug Lea (dl@rocky.oswego.edu) + +This file is part of the GNU C++ Library. This library is free +software; you can redistribute it and/or modify it under the terms of +the GNU Library General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your +option) any later version. This library is distributed in the hope +that it will be useful, but WITHOUT ANY WARRANTY; without even the +implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU Library General Public License for more details. +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + + +//# 1321 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" + +//# 26 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2 + +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1 +// This is part of the iostream library, providing -*- C++ -*- input/output. +// Copyright (C) 1991 Per Bothner. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free +// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" + +//# 27 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2 + + +//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 1 +// -*- C++ -*- +//# 107 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" + +//# 29 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2 + +//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1 +// -*- C++ -*- +//# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" + +//# 30 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2 + + +//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 1 +// -*- C++ -*- +//# 98 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" + +//# 32 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2 + + +// +// It is expected that this will be virtually multiply inherited +// into all of the classes that need error reporting services. +// +// The typical way to have that done is by inheriting the GctObject +// as a virtual base class. +// + +// +// GctErrorHandler class +// +// GPP_1_96_BUG +// NOTE - virtual public GttObject should be MI into GctObject - but that +// causes g++ 1.96 to segfault; so we must inherit GttObject here and use SI +// GPP_1_96_BUG +class GctErrorHandler: virtual public GttObject { +public: + GctErrorHandler(); + GctErrorHandler(const String& program); + virtual ~GctErrorHandler(); + + // + // Debugging messages + // - these are turned off for production code. + // - these messages can be shut off + // + static void debug(const char *message); + static void debug(tostrstream& message); + + static void debug(const char *function, const char *message); + static void debug(const char *function, tostrstream& message); + + static void debug(const char *class_name, const char *method, const char *message); + static void debug(const char *class_name, const char *method, tostrstream& message); + + static bool debug(); // current debug switch + static void debug(bool value); // change the debug switch + + // + // Informational messages + // - these correspond to a ``verbose'' mode + // - these are not errors, just chatty progress reports + // - these messages can be shut off + // + static void note(const char *message); + static void note(tostrstream& message); + + static void note(const char *function, const char *message); + static void note(const char *function, tostrstream& message); + + static void note(const char *class_name, const char *method, const char *message); + static void note(const char *class_name, const char *method, tostrstream& message); + + static bool note(); // current note switch + static void note(bool value); // change the note switch + + // + // Warning messages + // - warnings are system-recoverable errors + // - the system has noticed something and taken some + // corrective action + // - these messages can be shut off + // + static void warning(const char *message); + static void warning(tostrstream& message); + + static void warning(const char *function, const char *message); + static void warning(const char *function, tostrstream& message); + + static void warning(const char *class_name, const char *method, const char *message); + static void warning(const char *class_name, const char *method, tostrstream& message); + + static bool warning(); // current warning switch + static void warning(bool value); // change the warning switch + + // + // Error messages + // - an unacceptable, but expected and recoverable + // condition was detected + // - errors are for ``the expected environment was not found'' + // rather than for ``file couldn't be opened'' + // - these messages cannot be shut off + // - the error handler determines the recovery action + // TODO - one day exceptions will be used here + // + static void error(const char *message); + static void error(tostrstream& message); + + static void error(const char *function, const char *message); + static void error(const char *function, tostrstream& message); + + static void error(const char *class_name, const char *method, const char *message); + static void error(const char *class_name, const char *method, tostrstream& message); + + // can't turn off errors - no ``static void error(bool value);'' + static zero_arg_error_handler_t error(); // current error handler + static void error(zero_arg_error_handler_t handler);// change the error handler + + static void error_is_lib_error_handler(); // change the error handler + static void error_is_exit(); // change the error handler + + // Describes the fatal handler - WATCHOUT - implicitly uses AllocRing + static const char *error_handler_description(); + + // + // Fatal messages + // - an unacceptable and unexpected error was detected + // the data invariants were violated, there is no recovery + // - these messages cannot be shut off + // - the error handler determines the recovery action + // TODO - one day exceptions will be used here + // + static void fatal(const char *message); + static void fatal(tostrstream& message); + + static void fatal(const char *function, const char *message); + static void fatal(const char *function, tostrstream& message); + + static void fatal(const char *class_name, const char *method, const char *message); + static void fatal(const char *class_name, const char *method, tostrstream& message); + + // can't turn off fatals - no ``static void fatal(bool value);'' + static zero_arg_error_handler_t fatal(); // return the fatal handler + static void fatal(zero_arg_error_handler_t handler); // change the fatal handler + + static void fatal_is_exit(); // change the fatal handler + static void fatal_is_abort(); // change the fatal handler + + // Describes the fatal handler - WATCHOUT - implicitly uses AllocRing + static const char *fatal_handler_description(); +private: + // + // Two underscores are used here in order to prevent confusion of these + // private variables with any of the heir's private variables. Note that + // access control is different than visibility in C++, so all the variable + // names in a class hierarchy must be unique. + // + static bool __debug; + static bool __note; + static bool __warning; + static void (*__error_handler)(); // can't turn off errors + static void (*__fatal_handler)(); // can't turn off fatals + + static bool __partial_init; + static void __partial_initialize(); + static bool __full_init; + static void __full_initialize(const char *program); + static char *__program; + + static void __handle_error(); + static void __handle_fatal(); + static void __add_newline(const char *message); + static void __message_switch(bool value, bool& flag, const char *description); + static void __message_switch(bool value, bool& flag); + static const char *__describe_handler(zero_arg_error_handler_t handler); + + static bool __output_valid(); + static ostream *__output; + + // GPP_1_96_BUG + const char *class_name() const; + // GPP_1_96_BUG +}; + + +//# 29 "../../../../../../mips/include/Gct/Object/GctObject.h" 2 + + +// +// GctObject class (is abstract) +// +class GctObject: virtual public GctErrorHandler /*, virtual public GttObject*/ { +protected: + GctObject(); + GctObject(const GctObject&); + virtual ~GctObject(); // ensure descendants have virtual destructors + +public: + // + // I/O Support + // + // The value typically persists only long enough for an i/o operation + // to be performed (see the defintion of output via operator<<(... ) below) + virtual const char *stringify(); +protected: + // This is the buffer into which the printed representation of this + // object will be put when the time comes. It is associated with the + // object so it will never go away (so long as the object exists). + // Use a pointer so that you only pay for the space when I/O is used + tostrstream *stringbuf; + void clear_stringbuf(); + +public: + // + // Consistency (global consistency) + // + // The global data invariant for the whole object (heirs included). + // This OK function will call the local invariant function ok() if + // necessary and in addition the OK functions of the heirs + // This is expected to compute the data invariant of the object. + // It will execute GctErrorHandler::fatal if there is wrong. + virtual void OK() const; + +protected: + // + // consistency (local consistency) + // + // This function computes the invariant which is local to this object. + // It does not call any of the ancestor's OK() or ok() functions. + // It is not a virtual function so that it can be called from within a + // constructor with impunity. Thus this function MUST NOT call any + // virtual functions either; it should call them by their full name if + // that is necessary. The global OK() function will call this function + // as necessary. + // + // This function must NOT NEVER EVER be made virtual. + void ok() const; +protected: + // + // Class Name + // + // This must return a static (constant) string which is the name + // of the class being declared. By convention, not all classes + // must have one of these, but the major root abstract class must + // have one in order to allow the stringify() to work approximately + // correctly. + virtual const char *class_name() const = 0; + +public: + // + // The ``id'' of this object + // + // NOTE - we explicitly allow the situation where this function + // can return the address of the object - the ``this'' pointer + // instead of a computed id field (the __object_id field below). + // + // This function is protected because we don't want too much dependence + // on this notion of object identity. I want to be able to rip it + // out if it becomes to cumbersome. + unsigned objectId() const; +private: + // + // Symbolic ID + // + // NOTE - Normally this would be implemented by the `this' pointer. + // TODO - remove this for production code + // + // However, in order to make the test suites run on all machines, we + // make this into a symbolic id that is maintained with each object. + // Thus the valid outputs are always consistent across all machines. + unsigned __object_id; + static unsigned __next_id; +}; + +//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1 +// This is part of the iostream library, providing -*- C++ -*- input/output. +// Copyright (C) 1991 Per Bothner. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free +// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" + +//# 117 "../../../../../../mips/include/Gct/Object/GctObject.h" 2 + +extern ostream& operator<<(ostream&, GctObject&); + + +//# 25 "../../../../../../mips/include/Gct/Object/GctHashObject.h" 2 + + +// +// GctHashObject class (is abstract) +// +class GctHashObject: virtual public GctObject { +protected: + GctHashObject(); + GctHashObject(const GctHashObject&); + +public: + // + // hash support + // + virtual unsigned hash() const; +}; + + +//# 28 "../../GctSymbol.h" 2 + + +// +// GctSymbol +// +class GctSymbol: virtual public GctHashObject, String { +public: + GctSymbol(); // vacuous symbol required for genclass usage + GctSymbol(const char*); + GctSymbol(const String&); + GctSymbol(const GctSymbol&); + + operator const char *() const; + + bool operator==(const GctSymbol&) const; + bool operator!=(const GctSymbol&) const; + + bool operator<=(const GctSymbol&) const; + bool operator<(const GctSymbol&) const; + bool operator>=(const GctSymbol&) const; + bool operator>(const GctSymbol&) const; + + unsigned hash() const; + + // I/O Support + const char *stringify(); + + // Consistency + void OK() const; +private: + const char *class_name() const; +}; + +extern unsigned hash(GctSymbol&); // genclass support (no const) + +// +// Inline functions +// +// Note - none of the String operators save for operator const char *() +// are String member functions, instead, they are anonymous functions +// which work by overloading. +// + + + + + +GctSymbol::operator const char *() const +{ + + + + + + return String::operator const char *(); +} + +bool +GctSymbol::operator==(const GctSymbol& other) const +{ + + + + + + return (bool)::operator==(*this, other); +} + +bool +GctSymbol::operator!=(const GctSymbol& other) const +{ + + + + + + return (bool)::operator!=(*this, other); +} + +bool +GctSymbol::operator<=(const GctSymbol& other) const +{ + + + + + + return (bool)::operator<=(*this, other); +} + +bool +GctSymbol::operator<(const GctSymbol& other) const +{ + + + + + + return (bool)::operator<(*this, other); +} + +bool +GctSymbol::operator>=(const GctSymbol& other) const +{ + + + + + + return (bool)::operator>=(*this, other); +} + +bool +GctSymbol::operator>(const GctSymbol& other) const +{ + + + + + + return (bool)::operator>(*this, other); +} + + +//# 25 "GctSymbol.defs.h" 2 + + +// equality operator + + + + +// less-than-or-equal + + + + +// comparison : less-than -> 0 + + + + +// hash function + +extern unsigned int hash(GctSymbol&); + + + +// initial capacity for structures requiring one + + + + + + + +//# 27 "GctSymbol.GctSymbol.Map.h" 2 + + +class GctSymbolGctSymbolMap +{ +protected: + int count; + GctSymbol def; + +public: + GctSymbolGctSymbolMap(GctSymbol& dflt); + virtual ~GctSymbolGctSymbolMap(); + + int length(); // current number of items + int empty(); + + virtual int contains(GctSymbol& key); // is key mapped? + + virtual void clear(); // delete all items + + virtual GctSymbol& operator [] (GctSymbol& key) = 0; // access contents by key + + virtual void del(GctSymbol& key) = 0; // delete entry + + virtual Pix first() = 0; // Pix of first item or 0 + virtual void next(Pix& i) = 0; // advance to next or 0 + virtual GctSymbol& key(Pix i) = 0; // access key at i + virtual GctSymbol& contents(Pix i) = 0; // access contents at i + + virtual int owns(Pix i); // is i a valid Pix ? + virtual Pix seek(GctSymbol& key); // Pix of key + + GctSymbol& dflt(); // access default val + + void error(const char* msg); + virtual int OK() = 0; // rep invariant +}; + + + +inline GctSymbolGctSymbolMap::~GctSymbolGctSymbolMap() {} + +inline int GctSymbolGctSymbolMap::length() +{ + return count; +} + +inline int GctSymbolGctSymbolMap::empty() +{ + return count == 0; +} + +inline GctSymbol& GctSymbolGctSymbolMap::dflt() +{ + return def; +} + +inline GctSymbolGctSymbolMap::GctSymbolGctSymbolMap(GctSymbol& dflt) :def(dflt) +{ + count = 0; +} + + + + +//# 26 "GctSymbol.GctSymbol.CHMap.h" 2 + + + + + +struct GctSymbolGctSymbolCHNode +{ + GctSymbolGctSymbolCHNode* tl; + GctSymbol hd; + GctSymbol cont; + GctSymbolGctSymbolCHNode(); + GctSymbolGctSymbolCHNode(GctSymbol& h, GctSymbol& c, GctSymbolGctSymbolCHNode* t = 0); + ~GctSymbolGctSymbolCHNode(); +}; + + + +inline GctSymbolGctSymbolCHNode::GctSymbolGctSymbolCHNode() {} + +inline GctSymbolGctSymbolCHNode::GctSymbolGctSymbolCHNode(GctSymbol& h, GctSymbol& c, GctSymbolGctSymbolCHNode* t) + : hd(h), cont(c), tl(t) {} + +inline GctSymbolGctSymbolCHNode::~GctSymbolGctSymbolCHNode() {} + + + + +typedef GctSymbolGctSymbolCHNode* GctSymbolGctSymbolCHNodePtr; + + + + +class GctSymbolGctSymbolCHMap : public GctSymbolGctSymbolMap +{ +protected: + GctSymbolGctSymbolCHNode** tab; + unsigned int size; + +public: + GctSymbolGctSymbolCHMap(GctSymbol& dflt,unsigned int sz=100 ); + GctSymbolGctSymbolCHMap(GctSymbolGctSymbolCHMap& a); + ~GctSymbolGctSymbolCHMap(); + + GctSymbol& operator [] (GctSymbol& key); + + void del(GctSymbol& key); + + Pix first(); + void next(Pix& i); + GctSymbol& key(Pix i); + GctSymbol& contents(Pix i); + + Pix seek(GctSymbol& key); + int contains(GctSymbol& key); + + void clear(); + int OK(); +}; + + + +inline GctSymbolGctSymbolCHMap::~GctSymbolGctSymbolCHMap() +{ + clear(); + delete tab; +} + +inline int GctSymbolGctSymbolCHMap::contains(GctSymbol& key) +{ + return seek(key) != 0; +} + +inline GctSymbol& GctSymbolGctSymbolCHMap::key(Pix p) +{ + if (p == 0) error("null Pix"); + return ((GctSymbolGctSymbolCHNode*)p)->hd; +} + +inline GctSymbol& GctSymbolGctSymbolCHMap::contents(Pix p) +{ + if (p == 0) error("null Pix"); + return ((GctSymbolGctSymbolCHNode*)p)->cont; +} + + + + +//# 22 "GctSymbol.GctSymbol.CHMap.cc" 2 + + +// The nodes are linked together serially via a version +// of a trick used in some vtables: odd pointers are +// actually links to the next table entry. +// Not terrible, but not wonderful either + +static inline int goodCHptr(GctSymbolGctSymbolCHNode* t) +{ + return ((((unsigned)t) & 1) == 0); +} + +static inline GctSymbolGctSymbolCHNode* index_to_CHptr(int i) +{ + return (GctSymbolGctSymbolCHNode*)((i << 1) + 1); +} + +static inline int CHptr_to_index(GctSymbolGctSymbolCHNode* t) +{ + return ( ((unsigned) t) >> 1); +} + +GctSymbolGctSymbolCHMap::GctSymbolGctSymbolCHMap(GctSymbol& dflt, unsigned int sz) + :GctSymbolGctSymbolMap(dflt) +{ + tab = (GctSymbolGctSymbolCHNode**)(new GctSymbolGctSymbolCHNodePtr[size = sz]); + for (unsigned int i = 0; i < size; ++i) tab[i] = index_to_CHptr(i+1); + count = 0; +} + +GctSymbolGctSymbolCHMap::GctSymbolGctSymbolCHMap(GctSymbolGctSymbolCHMap& a) :GctSymbolGctSymbolMap(a.def) +{ + tab = (GctSymbolGctSymbolCHNode**)(new GctSymbolGctSymbolCHNodePtr[size = a.size]); + for (unsigned int i = 0; i < size; ++i) tab[i] = index_to_CHptr(i+1); + count = 0; + for (Pix p = a.first(); p; a.next(p)) (*this)[a.key(p)] = a.contents(p); // { dg-bogus "" } type `GctSymbol' is derived from private `String' +}
p784.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh26.C =================================================================== --- eh26.C (nonexistent) +++ eh26.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +class MyExceptionHandler { }; + +main() { + try { + throw MyExceptionHandler(); + } catch(const MyExceptionHandler& eh) { + return 0; + } catch(...) { + return 1; + } + return 1; +}
eh26.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: err1.C =================================================================== --- err1.C (nonexistent) +++ err1.C (revision 816) @@ -0,0 +1,8 @@ +// { dg-do assemble } + +struct gorf { + int stuff; + void snarf(); // { dg-error "" } +}; + +template void gorf::snarf() { return; } // { dg-error "" }
err1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: thunk2.C =================================================================== --- thunk2.C (nonexistent) +++ thunk2.C (revision 816) @@ -0,0 +1,39 @@ +// { dg-do run } +#include + +int state; +int fail; + +class A { +public: + A() { + if (++state != 1) + fail = 1; + } + virtual int foo() { + if (++state != 2) + fail = 1; + return 0; + } + virtual ~A() { + if (++state != 3) + fail = 1; + } +}; + +A* bar() { + return new A; +} + +int main() { + A *aptr = bar(); + aptr->foo(); + if (dynamic_cast (aptr) != aptr) + fail = 1; + if (typeid (*aptr) != typeid (A)) + fail = 1; + delete aptr; + if (++state != 4) + fail = 1; + return fail; +}
thunk2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p6611.C =================================================================== --- p6611.C (nonexistent) +++ p6611.C (revision 816) @@ -0,0 +1,27 @@ +// { dg-do run } +// prms-id: 6611 + +class COMPLEX { +public: + COMPLEX(double a, double b=0) { re = a; im = b; } + void print() const { } +private: + double re; + double im; +}; + +int main(void) +{ + COMPLEX a[3][3] = { + { 1, COMPLEX(2,3), COMPLEX(3,4), }, + { 1, COMPLEX(2,3), COMPLEX(3,4), }, + { 1, COMPLEX(2,3), COMPLEX(3,4), }, + }; + int i,j; + + for (i = 0; i < 3; i++) { + for (j = 0; j < 3; j++) { + a[i][j].print(); + } + } +}
p6611.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p6610a.C =================================================================== --- p6610a.C (nonexistent) +++ p6610a.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do run } +// prms-id: 6610 +// There is a bug in vtable thunks with multiple/virtual inheritance. + +int fail = 1; +struct B; +struct A { virtual int f(const B*) = 0; int g(const B*); }; +int A::g(const B* t) { return f(t); } +struct B : virtual A { B(); int f(const B*); B* B_this; }; +B::B() { if (g(this)) fail = 0; } +int B::f(const B* t) { return t == this; } +struct C : B { int f(const B*); int x; }; +int C::f(const B*) { return 0; } + +int main() { C c; return fail; }
p6610a.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: misc3.C =================================================================== --- misc3.C (nonexistent) +++ misc3.C (revision 816) @@ -0,0 +1,4 @@ +// { dg-do assemble } +// GROUPS uncaught +int a;// { dg-error "" } .* +int a;// { dg-error "" } .*
misc3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p8018.C =================================================================== --- p8018.C (nonexistent) +++ p8018.C (revision 816) @@ -0,0 +1,86 @@ +// { dg-do run } +// prms-id: 8018 + +class RefCount { +private: + int nref; + +public: + RefCount() : nref(0) {} + ~RefCount() {} + + int nrefs() const { return nref; } + int reference() { + nref++; + return nref; + } + int unreference() { + nref--; + return nref; + } +}; + +class A : public RefCount { +public: + A() {} + ~A() {} +}; + +class RefA { +private: + A *p; + + void clear() { + if (p) { + p->unreference(); + if (!p->nrefs()) + delete p; + } + } + +public: + RefA(A* a) : p(a) { if (p) p->reference(); } + RefA(const RefA& a) : p(a.p) { if (p) p->reference(); } + ~RefA() { clear(); } + + A* operator->() { return p; } + + RefA& operator=(const RefA& a) { + clear(); + p=a.p; + if (p) + p->reference(); + return *this; + } + + RefA& operator=(A* a) { + clear(); + p=a; + if (p) + p->reference(); + return *this; + } +}; + +class AccRefA { +private: + RefA a; + +public: + AccRefA(A* ap) : a(ap) {} + AccRefA(const RefA& ar) : a(ar) {} + ~AccRefA() {} + + operator RefA&() { return a; } + RefA& result() { return a; } +}; + +int +main() { + RefA a1 = new A; + AccRefA aa1(a1); + RefA a3 = aa1; + + if (a1->nrefs() != 3) + return 1; +}
p8018.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p1862.C =================================================================== --- p1862.C (nonexistent) +++ p1862.C (revision 816) @@ -0,0 +1,63 @@ +// { dg-do run } +// GROUPS vtable +extern "C" int printf (const char *, ...); + +class A +{ +public: + virtual ~A(){}; + virtual int type(void) + { + return -1; + } +}; + +class B +{ +public: + virtual ~B(){}; +}; + + +class C0 : public B, public A +{ +public: + virtual int type(void) + { + return 0; + } +}; + +class C1 : public C0 +{ +public: + virtual int type(void) + { + return 1; + } +}; + +class C2 : public C0 +{ +public: + virtual int type(void) + { + return 2; + } +}; + +int main() +{ + C1 *one = new C1; + + if (one->type() == 1) + { + printf ("PASS\n"); + return 0; + } + else + { + printf ("FAIL\n"); + return 1; + } +}
p1862.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p2736.C =================================================================== --- p2736.C (nonexistent) +++ p2736.C (revision 816) @@ -0,0 +1,31 @@ +// { dg-do run } +// This is a poor test case, it is meant to ensure that function local +// statics are destroyed at the right time. See PR 2736 for details. +// prms-id: 2736 + +#include + +int count; + +struct A { + int which; + A(int i) :which(i) { + // printf("ctor %x\n", this); + } + ~A() { + // printf("dtor %x\n", this); + if (++count != which) + abort (); + } +}; + +void +foo() { + static A a(1); +} + +A a(2); + +int main() { + foo(); +}
p2736.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3708.C =================================================================== --- p3708.C (nonexistent) +++ p3708.C (revision 816) @@ -0,0 +1,87 @@ +// { dg-do run } +// prms-id: 3708 + +extern "C" int printf (const char *, ...); +extern "C" int atoi (const char *); + +void *ptr; + +class A { +public: + A() { printf ("A is constructed.\n"); } + virtual void xx(int doit) { printf ("A is destructed.\n"); } +}; + +class A1 { +public: + A1() { printf ("A1 is constructed.\n"); } + virtual void xx(int doit) { printf ("A1 is destructed.\n"); } +}; + +class B : public virtual A, public A1 { +public: + B() { printf ("B is constructed.\n"); } + virtual void xx(int doit) { + printf ("B is destructed.\n"); + A1::xx (1); + if (doit) A::xx (1); + } +}; + +int num; + +class C : public virtual A, public B { +public: + C() { ++num; printf ("C is constructed.\n"); + ptr = this; + } + virtual void xx(int doit) { + --num; + if (ptr != this) + printf("FAIL\n%x != %x\n", ptr, this); + printf ("C is destructed.\n"); + B::xx (0); + if (doit) A::xx (1); + } +}; + +void fooA(A *a) { + printf ("Casting to A!\n"); + a->xx (1); +} +void fooA1(A1 *a) { + printf ("Casting to A1!\n"); + a->xx (1); +} + +void fooB(B *b) { + printf ("Casting to B!\n"); + b->xx (1); +} + +void fooC(C *c) { + printf ("Casting to C!\n"); + c->xx (1); +} + +int main(int argc, char *argv[]) { + printf ("*** Construct C object!\n"); + C *c = new C(); + + int i = 0; + + printf ("*** Try to delete the casting pointer!\n"); + switch (i) + { + case 0: fooA1(c); + break; + case 1: fooA(c); + break; + case 2: fooB(c); + break; + case 3: fooC(c); + break; + } + + return num!=0; +}
p3708.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p8175.C =================================================================== --- p8175.C (nonexistent) +++ p8175.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// prms-id: 8175 + +class AtoBoolC { +public: + AtoBoolC(const AtoBoolC& aBool); +private: + int myValue; +}; + +struct TestCase { + AtoBoolC is_call_on_unack; +}; + +static TestCase the_cases[] = { { 0 } }; // { dg-error "" }
p8175.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns13.C =================================================================== --- ns13.C (nonexistent) +++ ns13.C (revision 816) @@ -0,0 +1,13 @@ +// { dg-do assemble } + +namespace N { + struct C { + C(); + }; +} + +namespace M { + struct C { + C(); + }; +}
ns13.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p2846a.C =================================================================== --- p2846a.C (nonexistent) +++ p2846a.C (revision 816) @@ -0,0 +1,35 @@ +// { dg-do run } +// Shows that problem of initializing one object's vtable pointer from +// another object's vtable pointer when doing a default copy of it +// and the vtable pointer involved is the main one. + +// Correct answer is B::print. +// g++ prints D::print, which is wrong. Cfront gets is right. + +// prms-id: 2846 + +extern "C" int printf(const char *, ...); +extern "C" void exit(int); + +class B { +public: + virtual void print(void) const { printf("B::print\n"); } +}; + +class D : public B { +public: + void print(void) const { printf("D::print\n"); exit(1); } + B compute(void) const; +}; + +B D::compute(void) const +{ + B sub(*(B*)this); + return sub; +} + +int main () { + D titi; + titi.compute().print(); + return 0; +}
p2846a.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net31.C =================================================================== --- net31.C (nonexistent) +++ net31.C (revision 816) @@ -0,0 +1,68 @@ +// { dg-do assemble } + +class foo_a { + protected: + double func(int xi) {return 0.0;} + public: + foo_a() {} +}; + +class foo_b { + public: + foo_b(int); + foo_b(); + ~foo_b(); + foo_b(const foo_b&); + double& operator()(int); + foo_b& operator=(foo_b&); + void bar_a(int); +}; + +foo_b& operator*(foo_b&, foo_b&); +foo_b& operator*(double, foo_b&); + +template +class foo_c { + typedef double (TP::* Tmatf)(int); + int m; + Tmatf* a; + void foo_cinst (int mm); + public: + foo_c(int mm); + foo_c() {m = 0; a = 0;} + ~foo_c() {delete a;} + double (TP::*& operator()(int i))(int) {return a[i];} + foo_b& bug_func(int); +}; + +template +foo_b& foo_c::bug_func(int x) { + static foo_b retval(m); + retval.bar_a(m); + for (register int i = 0; i < m; i++) + retval(i) = (*(operator()(i)))(x); // { dg-error "" } + return retval; +} + +template +class foo_d { + protected: + foo_c bar_b; + public: + foo_d() {} + virtual ~foo_d() {} + virtual void setfoo_c(); +}; + +class foo_e : public foo_a, public foo_d { + public: + foo_e(); + ~foo_e() {} + void setfoo_c(); +}; + +void foo_e::setfoo_c() { + bar_b(0) = func; // { dg-error "" } +} + +template class foo_c;
net31.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net14.C =================================================================== --- net14.C (nonexistent) +++ net14.C (revision 816) @@ -0,0 +1,7 @@ +// { dg-do assemble } +// this probably does not have correct debugging info generated. + +typedef struct Thing { + Thing(); + int x; +} Thing;
net14.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh10.C =================================================================== --- eh10.C (nonexistent) +++ eh10.C (revision 816) @@ -0,0 +1,28 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +void foo() { + int i; + i = 42; + throw i; +} + +void ee(int *); + +void bar() { + int i = 2; + ee(&i); +} + +void ee(int *) { } + +main() { + try { + foo(); + return 3; + } catch (int& i) { + bar(); + return i != 42; + } + return 2; +}
eh10.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: misc13.C =================================================================== --- misc13.C (nonexistent) +++ misc13.C (revision 816) @@ -0,0 +1,54 @@ +// { dg-do run } +// GROUPS passed vtable +extern "C" int printf (const char *, ...); +enum E { vf_request, vf_event } want; + +int errs = 0; + +class ivResource { +public: + virtual ~ivResource () { } +}; + +class ivHandler : public ivResource { +public: + virtual void event() { } +}; + +class ivGlyph : public ivResource { +public: + virtual ~ivGlyph () { } + virtual void request () { + if (want!=vf_request) + ++errs; + } +}; + +class ItemView : public ivGlyph, public ivHandler { +public: + virtual void event () { + if (want!=vf_event) + ++errs; + } +} a; + +ivGlyph *bar() { + return &a; +} + +ivHandler *bar2() { + return &a; +} + +int main() { + want=vf_request; + bar()->request(); + want=vf_event; + bar2()->event(); + if (errs) { + printf("FAIL\n"); + return 1; + } + printf("PASS\n"); + return 0; +}
misc13.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: s35520.C =================================================================== --- s35520.C (nonexistent) +++ s35520.C (revision 816) @@ -0,0 +1,4 @@ +// { dg-do assemble } + +static void kbdNormal() { } +void (*keyHandler)() = kbdNormal;
s35520.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: asm1.C =================================================================== --- asm1.C (nonexistent) +++ asm1.C (revision 816) @@ -0,0 +1,9 @@ +// { dg-do assemble } +// { dg-options "" } + +struct A { + static void foo() asm("_my_routine"); +}; + +void A::foo() { +}
asm1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net39.C =================================================================== --- net39.C (nonexistent) +++ net39.C (revision 816) @@ -0,0 +1,31 @@ +// { dg-do run } +void *vp; + +class silly { +public: + virtual int b() { return 1; } +}; +class solly : silly { +public: + virtual int b() { return 2; } +}; +class thing { +public: + virtual int a() { return 3; } +}; +class thong : public solly, public thing { +public: + virtual int a() { + if (this != vp) return 4; + else return 0; + } +}; + +typedef int(thing::*ping)(); +ping qq = &thing::a; + +int main() { + thong b; + vp = &b; + return (b.*qq)(); +}
net39.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh52.C =================================================================== --- eh52.C (nonexistent) +++ eh52.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do run } +// { dg-options "-fexceptions -O9" } + +int promote_mode (int mode, int *punsignedp) +{ + int unsignedp = *punsignedp; + *punsignedp = unsignedp; + return mode; +} + +int main() { + int i; + i = promote_mode (42, &i); + return i != 42; +}
eh52.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pmf2.C =================================================================== --- pmf2.C (nonexistent) +++ pmf2.C (revision 816) @@ -0,0 +1,55 @@ +// { dg-do run } +extern "C" int printf(const char *, ...); + +class A_table { + int c; +public: + A_table() { c = 3;} + virtual void func2(int &item) { printf("func2(%d,) c=%d\n",item,c);} +}; + +class B_table : private A_table { +public: + typedef void (B_table::* B_ti_fn) (int &item); + B_table() { j = 0x4321;} + virtual void call_fn_fn1(int &item, void *pfn1); + void func1(int &item) { printf("func1(%d)\n",item);} + virtual void func2(int &item) { printf("func2(%d) j=%d\n",item,j);} + int j; +}; + +class foo : public A_table { +public: + int i; + virtual ~foo(); + virtual void func2(int &item) { printf("func2(%d) i=%d\n",item,i);} +}; +foo::~foo() { i = 0;} + +class bar :public foo,public B_table { +public: + int w; + virtual ~bar(); + virtual void func2(int &item) { printf("func2(%d) w=%d\n",item,w);} +}; +bar::~bar() { w = 0;} + +void B_table::call_fn_fn1(int &item, void *pfn1) { + (this->*(*(B_ti_fn*)pfn1))(item); +} + +B_table b; +bar jar; + +int main() { + printf("ptr to B_table=%x, ptr to A_table=%x\n",&b,(A_table*)&b); + B_table::B_ti_fn z = &B_table::func1; + int j = 1; + jar.call_fn_fn1(j,(void *)&z); + j++; + z = &B_table::func2; + b.call_fn_fn1(j,(void *)&z); + j++; + jar.call_fn_fn1(j,(void *)&z); + return 0; +}
pmf2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh35.C =================================================================== --- eh35.C (nonexistent) +++ eh35.C (revision 816) @@ -0,0 +1,17 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +main() { + try { + throw 'a'; + } catch (char a) { + try { + throw 'a'; + } catch (int i) { + return 1; + } catch (char c) { + return 0; + } + } + return 1; +}
eh35.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh18.C =================================================================== --- eh18.C (nonexistent) +++ eh18.C (revision 816) @@ -0,0 +1,63 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +class VB { +public: + int n; + VB (int v) { n = v; } + VB (const VB& o) { + n = o.n; +// printf("copying VB from %d to %d\n", &o, this); + } +}; + +class D : public virtual VB { + int j; +public: + D(int i1, int i2) : VB(i2) { j = i1; } + VB& vb() { return *(VB*)this; } + const VB& vb() const { return *(const VB*)this; } +}; + +class pD : private virtual VB { + int j; +public: + pD(int i1, int i2) : VB(i2) { j = i1; } + VB& vb() { return *(VB*)this; } + const VB& vb() const { return *(const VB*)this; } +}; + + +int main () { + D d(1943, 4279); + pD pd(3621, 9527); + VB *vb = &d.vb(); + VB *pvb = &pd.vb(); + + // A catch of a public virtual base. + try { +// printf("Throwing D at %d (VB at %d)\n", &d, vb); + throw d; + } + catch (VB& vb) { +// printf("Catching VB at %d\n", &vb); + if (vb.n != 4279) + return 1; + } + catch (...) { + return 1; + } + + // A catch of a private virtual base. + try { +// printf("Throwing D at %d (VB at %d)\n", &pd, pvb); + throw pd; + } + catch (VB& vb) { +// printf("Catching VB at %d\n", &vb); + // This was a private base of the throw object, don't catch it. + return 1; + } + catch (...) { + } +}
eh18.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns6.C =================================================================== --- ns6.C (nonexistent) +++ ns6.C (revision 816) @@ -0,0 +1,9 @@ +// { dg-do assemble } + +namespace A { + int i = 1; +} + +namespace A { + int j = i; +}
ns6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net2.C =================================================================== --- net2.C (nonexistent) +++ net2.C (revision 816) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// Here is another program from the net. + +class B; + +class A { // { dg-error "" } copy ctor candidate + private: + A(B *); // { dg-error "" } + public: + A(long); // { dg-error "" } +}; + +A a(0); // { dg-error "" } should be ambigious
net2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: align1.C =================================================================== --- align1.C (nonexistent) +++ align1.C (revision 816) @@ -0,0 +1,57 @@ +// { dg-do run } +// Check to make sure we align virtual base classes properly + +class eel_base { +public: +}; + +class markable_eel_base : public eel_base { +private: + int mark; +}; + +class eel_edge : public markable_eel_base { +public: +private: + int foo; +}; + +class edge : public virtual eel_edge { +public: + edge() { + _weight = 0.0; + } +private: + double _weight; +}; +class eel_branch_edge : public virtual edge { +}; +class branch_edge : public eel_branch_edge { +}; + +class eel_interproc_branch_edge : public branch_edge { +}; + +class interproc_edge : public virtual edge { +}; + +class eel_jump_edge : public virtual edge { +protected: +}; + +class jump_edge : public eel_jump_edge { +public: +}; + +class eel_interproc_jump_edge : public jump_edge { +protected: +}; + +class interproc_jump_edge : public eel_interproc_jump_edge, + public interproc_edge { +public: +}; + +int main () { + void *vp = new interproc_jump_edge(); +}
align1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh1.C =================================================================== --- eh1.C (nonexistent) +++ eh1.C (revision 816) @@ -0,0 +1,38 @@ +// { dg-do assemble } +// { dg-options "-fexceptions -O -S" } + +extern "C" int printf (const char *, ...); +extern "C" int atoi (const char *); +extern "C" void exit (int); + +struct Exception + { + int v; + Exception(int i) { v = i; }; + }; + + void inc(int &i) + { + try { + if (i == 0) + throw Exception(i); + else + i++; + } + catch (Exception v) { + i = v.v; + } + } + +main (int argc, const char *argv[]) +{ + if (argc != 2) + { + printf ("usage: a.out \n"); + exit (1); + } + int count = atoi (argv[1]); + inc (count); + printf ("success\n"); + exit (0); +}
eh1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p7651.C =================================================================== --- p7651.C (nonexistent) +++ p7651.C (revision 816) @@ -0,0 +1,26 @@ +// { dg-do run } +// prms-id: 7651 + +int fail = 0; + +class Foo { +public: + Foo(double i) : data(i) { if (data != 1.0) fail = 1; } + ~Foo() { if (data != 1.0) fail = 1; } +private: + volatile double data; +}; + +int DingDong(double A) { + volatile Foo a(A); + + if ( A != 0.0 ) { + return 1; + } + return 0; +} + + +int main() { + DingDong(1.0); +}
p7651.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p5673.C =================================================================== --- p5673.C (nonexistent) +++ p5673.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do run } +// prms-id: 5673 + +class A { +public: + operator int () { + return 7; + } + ~A(); +}; + +int foo() { + return A(); +} + +int main() { + return foo() != 7; +} + +A::~A() { +}
p5673.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh9.C =================================================================== --- eh9.C (nonexistent) +++ eh9.C (revision 816) @@ -0,0 +1,4 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +main() throw () { }
eh9.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4667.C =================================================================== --- p4667.C (nonexistent) +++ p4667.C (revision 816) @@ -0,0 +1,32 @@ +// { dg-do run } +// prms-id: 4667 + +int counter = 0; +int a = 0; +int b = 0; +int c = 0; + +struct A { + A() { a = counter++; } +}; + +struct B { + B() { b = counter++; } +}; + +struct C : public virtual B { + C() { c = counter++; } +}; + +struct D : public virtual A, public virtual C { }; + +extern "C" int printf(const char*,...); +int main(void) { + D d; + + if (!(a == 0 && b == 1 && c == 2)) { + return 1; + } + + return 0; +}
p4667.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p701.C =================================================================== --- p701.C (nonexistent) +++ p701.C (revision 816) @@ -0,0 +1,34 @@ +// { dg-do assemble } +// prms-id: 701 + +extern "C" +{ + int printf(const char *, ...); +} + + +void Munge(int& x) // { dg-error "passing argument 1" } +{ + x = 2; +} + + +class A +{ + public: + int i; + A(int x) : i(x) {} + void Safe() const; +}; + +void +A::Safe() const +{ + Munge(i); // { dg-error "invalid initialization" } +} + +int main() +{ + const A a(1); + a.Safe(); +}
p701.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: warn3.C =================================================================== --- warn3.C (nonexistent) +++ warn3.C (revision 816) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// { dg-options "-Wall" } + +class B { +public: + B(int) { } +}; + +class D : public B { + int member; // { dg-warning "" } reordered + D() : member(0), B(member) { } // { dg-warning "" } reordered +};
warn3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net40.C =================================================================== --- net40.C (nonexistent) +++ net40.C (revision 816) @@ -0,0 +1,19 @@ +// { dg-do run } +#include +#include + +class toto { +public: + void * operator new (size_t t) { + abort(); + } + void operator delete (void*p, size_t t) { + abort(); + } +}; + +int main() { + toto * p; + p = new toto[5]; + delete [] p; +}
net40.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p5958.C =================================================================== --- p5958.C (nonexistent) +++ p5958.C (revision 816) @@ -0,0 +1,28 @@ +// { dg-do run } +// { dg-options "-ansi" } +// prms-id: 5958 + +class A { }; + +main() { + int i = 1; + if (1 not_eq 1) + return 1; + if (not (1 and 1)) + return 1; + if (not (1 or 1)) + return 1; + if (compl ~0) + return 1; + if (1 bitand 2) + return 1; + if (not (1 bitor 2)) + return 1; + if (1 xor 1) + return 1; + i and_eq 1; + i or_eq 2; + i xor_eq 4; + if (i not_eq 7) + return 1; +}
p5958.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net23.C =================================================================== --- net23.C (nonexistent) +++ net23.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do assemble } + +class environment { +public: + int get_font() ; +}; + +typedef int (environment::*INT_FUNCP)(); + +void myfoo(INT_FUNCP a); + +void init_env_requests() +{ + myfoo(&environment::get_font); +}
net23.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: leak1.C =================================================================== --- leak1.C (nonexistent) +++ leak1.C (revision 816) @@ -0,0 +1,39 @@ +// { dg-do run } +int count = 0; + +class T { + int i; +public: + T() { + i = 1; + ++count; + } + T(const T& o) { + i = o.i; + ++count; + } + T operator +(const T& o) { + T r; + r.i = this->i + o.i; + return r; + } + operator int () { + return i; + } + ~T() { + --count; + } +} s, b; + +void bar() { + static int j = int(s+b); + int i = int(s+b); +} + +int i = int(s+b); + +int main() { + bar(); + bar(); + return count != 2; +}
leak1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dyncast8.C =================================================================== --- dyncast8.C (nonexistent) +++ dyncast8.C (revision 816) @@ -0,0 +1,19 @@ +// { dg-do run } +#include + +class Base +{ +public: + virtual ~Base() { } +}; + +class Derived : public Base { }; + +int main() +{ + const Derived b; + const Base* ap = &b; + + const Derived* p1 = dynamic_cast(ap); + return p1 == 0; +}
dyncast8.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p807.C =================================================================== --- p807.C (nonexistent) +++ p807.C (revision 816) @@ -0,0 +1,35 @@ +// { dg-do assemble } +// prms-id: 807 + +extern "C" int printf(const char*, ...); + +class B; + +class AX +{ + protected: + int x; + + public: + operator B(); +}; + + +class B +{ + private: + int x; + public: + B(const AX&); +}; + + +int foo(B& b); // { dg-error "" } referenced below + + +int main() +{ + AX a; + foo(a); // { dg-error "" } Ambiguous B(a) or a.operator B() // See ARM 12.3.2 + +}
p807.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: hog1.C =================================================================== --- hog1.C (nonexistent) +++ hog1.C (revision 816) @@ -0,0 +1,188 @@ +// { dg-do run } +class dummy { public: void operator++(void) {} + }; +class dummy_000 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_001 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_002 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_003 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_004 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_005 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_006 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_007 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_008 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_009 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_010 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_011 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_012 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_013 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_014 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_015 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_016 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_017 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_018 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_019 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_020 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_021 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_022 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_023 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_024 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_025 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_026 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_027 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_028 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_029 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_030 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_031 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_032 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_033 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_034 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_035 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_036 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_037 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_038 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_039 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_040 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_041 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_042 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_043 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_044 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_045 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_046 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_047 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_048 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; +class dummy_049 : private virtual dummy { public: void operator++(void) { +dummy::operator++(); } }; + +class super : + private dummy_000, private dummy_001, private dummy_002, private +dummy_003, private dummy_004, + private dummy_005, private dummy_006, private dummy_007, private +dummy_008, private dummy_009, + private dummy_010, private dummy_011, private dummy_012, private +dummy_013, private dummy_014, + private dummy_015, private dummy_016, private dummy_017, private +dummy_018, private dummy_019, + private dummy_020, private dummy_021, private dummy_022, private +dummy_023, private dummy_024, + private dummy_025, private dummy_026, private dummy_027, private +dummy_028, private dummy_029, + private dummy_030, private dummy_031, private dummy_032, private +dummy_033, private dummy_034, + private dummy_035, private dummy_036, private dummy_037, private +dummy_038, private dummy_039, + private dummy_040, private dummy_041, private dummy_042, private +dummy_043, private dummy_044, + private dummy_045, private dummy_046, private dummy_047, private +dummy_048, private dummy_049 +{ +public: + void operator++(void); +}; + +void super::operator++(void) +{ + dummy_000::operator++(); + dummy_001::operator++(); + dummy_002::operator++(); + dummy_003::operator++(); + dummy_004::operator++(); + dummy_005::operator++(); + dummy_006::operator++(); + dummy_007::operator++(); + dummy_008::operator++(); + dummy_009::operator++(); + dummy_010::operator++(); + dummy_011::operator++(); + dummy_012::operator++(); + dummy_013::operator++(); + dummy_014::operator++(); + dummy_015::operator++(); + dummy_016::operator++(); + dummy_017::operator++(); + dummy_018::operator++(); + dummy_019::operator++(); + dummy_020::operator++(); + dummy_021::operator++(); + dummy_022::operator++(); + dummy_023::operator++(); + dummy_024::operator++(); + dummy_025::operator++(); + dummy_026::operator++(); + dummy_027::operator++(); + dummy_028::operator++(); + dummy_029::operator++(); + dummy_030::operator++(); + dummy_031::operator++(); + dummy_032::operator++(); + dummy_033::operator++(); + dummy_034::operator++(); + dummy_035::operator++(); + dummy_036::operator++(); + dummy_037::operator++(); + dummy_038::operator++(); + dummy_039::operator++(); + dummy_040::operator++(); + dummy_041::operator++(); + dummy_042::operator++(); + dummy_043::operator++(); + dummy_044::operator++(); + dummy_045::operator++(); + dummy_046::operator++(); + dummy_047::operator++(); + dummy_048::operator++(); + dummy_049::operator++(); +} + + +int main(void) +{ +}
hog1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p10951.C =================================================================== --- p10951.C (nonexistent) +++ p10951.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// prms-id: 10951 + +inline int m1(const int& a) { + return 1; +} + +template +class A { +public: + typedef int st; + + static int m2t() { + return m1(1); + } +}; + +A::st i; +int m3() { + return A::m2t(); +}
p10951.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net48.C =================================================================== --- net48.C (nonexistent) +++ net48.C (revision 816) @@ -0,0 +1,14 @@ +// { dg-do assemble } + +const char *a="aê"; + +class A +{ +public: + A() + { + const char *b="aê"; + } +}; + +const char *c="aê";
net48.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pt1.C =================================================================== --- pt1.C (nonexistent) +++ pt1.C (revision 816) @@ -0,0 +1,37 @@ +// { dg-do run } +template +class A { +public: + A (T at, V av); + void print () { } +protected: + T t; + V v; +}; + +template +A::A (T at, V av) { + t = at; + v = av; +} + + +template +class B: public virtual A { +public: + B (T at, V av); + void print () { } +}; + +template +B::B (T at, V av) : A (at, av) { } // { dg-bogus "" } + +int main () { + int i = 2; + double x = 2; + + B ab(i, x); + ab.print(); + + return 0; +}
pt1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh44.C =================================================================== --- eh44.C (nonexistent) +++ eh44.C (revision 816) @@ -0,0 +1,36 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } +// prms-id: 9159 + +static unsigned int iCounter = 0; +static unsigned int iMax; +int fail = 0; + +class ca { +public: + ca(int) { + if (iCounter++ == iMax) + throw (const char*)"iCounter"; + } + virtual ~ca() { + } +}; + +class cc { +public: + cc(const ca &rca1, const ca &rca2) { + } + virtual ~cc() { + fail = 1; + } +}; + + +int main(int argc, char **argv) { + iMax = 1; + try { + cc sc(ca(1), ca(1)); + } catch (const char *pMsg) { + } + return fail; +}
eh44.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: virt1.C =================================================================== --- virt1.C (nonexistent) +++ virt1.C (revision 816) @@ -0,0 +1,13 @@ +// { dg-do assemble } + +struct S0 { virtual void f1 () { } }; + +struct S1 : virtual public S0 { virtual void f1 () { } }; + +struct S2 : public S1 { virtual void f1 () { } }; + +struct S3 : virtual public S0 { virtual void f1 () { } }; + +struct S4 : public S3 { }; + +void creator () { new S4; }
virt1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh27.C =================================================================== --- eh27.C (nonexistent) +++ eh27.C (revision 816) @@ -0,0 +1,17 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +#include + +class MyExceptionHandler { }; + +main() { + try { + throw MyExceptionHandler(); + } catch(const MyExceptionHandler& eh) { + return 0; + } catch(...) { + return 1; + } + return 1; +}
eh27.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3041.C =================================================================== --- p3041.C (nonexistent) +++ p3041.C (revision 816) @@ -0,0 +1,34 @@ +// { dg-do run } +// prms-id: 3041 + +class A { +public: + A() { } + virtual void a() = 0; + static int b(A * p) { + p->a(); + return 1; + } +}; + +class B : virtual public A { +public: + B() { + static int installed = b(this); + } + void a() { } +}; + +class C : virtual public B { +public: + C() { + static int installed = b(this); + } + void a() { } +}; + +int main() +{ + C c; + return 0; +}
p3041.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: err2.C =================================================================== --- err2.C (nonexistent) +++ err2.C (revision 816) @@ -0,0 +1,7 @@ +// { dg-do assemble } +class foo { +public: + void apply(foo *(foo::*memptr)()) { + this->*memptr(); // { dg-error "" } wrong + } +};
err2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4511.C =================================================================== --- p4511.C (nonexistent) +++ p4511.C (revision 816) @@ -0,0 +1,34 @@ +// { dg-do run } +// prms-id: 4511 + +int bad; + +class A { +public: + virtual void dummy (){}; +}; + +class B { +public: + virtual void f(void) = 0; +}; + +class C : public A, public B { +public: + void f(void) { bad=1; }; +}; + +class D : public C { +public: + void f(void) { }; +}; + +class E : public D { }; + +int main() { + E e; + e.f(); + E * ep = &e; + ep->f(); + return bad; +}
p4511.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: thunk3.C =================================================================== --- thunk3.C (nonexistent) +++ thunk3.C (revision 816) @@ -0,0 +1,35 @@ +// { dg-do run } +int state; +int fail; + +class A { +public: + A() { + if (++state != 1) + fail = 1; + } + virtual int foo() { + if (++state != 2) + fail = 1; + return 0; + } + virtual ~A() { + if (++state != 3) + fail = 1; + } +}; + +A* bar() { + return new A; +} + +int main() { + A *aptr = bar(); + aptr->foo(); + if (dynamic_cast (aptr) != aptr) + fail = 1; + delete aptr; + if (++state != 4) + fail = 1; + return fail; +}
thunk3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p6610b.C =================================================================== --- p6610b.C (nonexistent) +++ p6610b.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do run } +// prms-id: 6610 + +int fail = 1; +struct B; +struct A { virtual int f(const B*) = 0; int g(const B*); }; +int A::g(const B* t) { return f(t); } +struct B : virtual A { int f(const B*); B* B_this; }; +int B::f(const B* t) { return t == this; } +struct S1 { }; +struct C : virtual S1, virtual B, virtual A { C(); }; +C::C() { if (g(this)) fail = 0; } +struct D : virtual B, virtual A, C { }; + +int main() { D d; return fail; }
p6610b.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p6058.C =================================================================== --- p6058.C (nonexistent) +++ p6058.C (revision 816) @@ -0,0 +1,18 @@ +// { dg-do assemble } +// { dg-options "-fexceptions -pedantic-errors" } +// prms-id: 6058 + +void bar(struct s1 { } a) { (void)a; } // { dg-error "" } + +struct s2*fooey() +{ + try { + static_cast(0); // { dg-error "" } + const_cast((s4*)0); // { dg-error "" } + reinterpret_cast((s3*)0); // { dg-error "" } + dynamic_cast((s6*)0); // { dg-error "" } + (struct s7 { } *)(int*)0xffedec; // { dg-error "" } + } catch (struct s8 { } s) { // { dg-error "" } + } + return 0; +}
p6058.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p9506.C =================================================================== --- p9506.C (nonexistent) +++ p9506.C (revision 816) @@ -0,0 +1,7 @@ +// { dg-do assemble } +// prms-id: 9506 + +char * volatile p; +void foo() { + --p = 0; +}
p9506.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p7626.C =================================================================== --- p7626.C (nonexistent) +++ p7626.C (revision 816) @@ -0,0 +1,43 @@ +// { dg-do assemble } +// prms-id: 7626 + +int fail; + +typedef unsigned int UINT; + +class CObject{}; + +class CCmdTarget : public CObject { +}; + +typedef void (CCmdTarget::*AFX_PMSG)(void); + +struct AFX_MSGMAP_ENTRY { + AFX_PMSG pfn; +}; + +class CWnd : public CCmdTarget { +public: + void OnMyMsg() { fail = 1; } // If this one is called, something is wrong. + static AFX_MSGMAP_ENTRY _messageEntries[]; +}; + +typedef void (CWnd::*AFX_PMSGW)(void); + +class CDialog : public CWnd +{ +public: + void OnMyMsg() { } + static AFX_MSGMAP_ENTRY _messageEntries[]; +}; + +AFX_MSGMAP_ENTRY CDialog ::_messageEntries[] = { + { (AFX_PMSG)(AFX_PMSGW)(void (CWnd::*)())&CDialog::OnMyMsg }, + { (AFX_PMSG)0 } +}; + +int main() { + CDialog d; + (d.*((CDialog::_messageEntries)[0]).pfn)(); // This should call CDialog::OnMyMsg + return fail; +}
p7626.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns14.C =================================================================== --- ns14.C (nonexistent) +++ ns14.C (revision 816) @@ -0,0 +1,11 @@ +// { dg-do assemble } + +namespace Jazz { + int horn( int h ) { return 1; } +} + +using Jazz::horn; + +namespace Jazz { + int horn ( char c ) { return 0; } +}
ns14.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p2846b.C =================================================================== --- p2846b.C (nonexistent) +++ p2846b.C (revision 816) @@ -0,0 +1,53 @@ +// { dg-do run } +// Shows that problem of initializing one object's secondary base from +// another object via a user defined copy constructor for that base, +// the pointer for the secondary vtable is not set after implicit +// copying of the outer class, but rather has the pointer to the main +// vtable for the secondary base left over from the user defined copy +// constructor for that base. + +// Correct answer is B::beefy. +// g++ prints A::beefy, which is wrong. Cfront gets it right. + +// prms-id: 2846 + +extern "C" int printf(const char *, ...); +extern "C" void exit(int); + +class B; + +class A { + public: + + A(void){} + A(const A&){} + + virtual void print(void) const { } + B compute(void) const; +}; + +class C { +public: + C() { } + C(C& o) { } // with it, things are wrong, without it, they're ok + virtual void beefy(void) const { printf("A::beefy\n"); exit(1); } +}; + +class B : private A, public C { +public: + B(const A& x, int){} + void beefy(void) const { printf("B::beefy\n"); } +}; + +B A::compute(void) const +{ + B sub(*this, 1); + return sub; +} + +int main () +{ + A titi; + titi.compute().beefy(); + return 0; +}
p2846b.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4693.C =================================================================== --- p4693.C (nonexistent) +++ p4693.C (revision 816) @@ -0,0 +1,24 @@ +// { dg-do assemble } +// prms-id: 4693 + +class a { +public: + virtual ~a(); +}; + +class b { +public: + virtual void set_var() = 0; +}; + +class c : public b, public a { }; + +class d : public c { +public: + void set_var() { } +}; + +int main() { + d * test; + test = new d; +}
p4693.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p710.C =================================================================== --- p710.C (nonexistent) +++ p710.C (revision 816) @@ -0,0 +1,43 @@ +// { dg-do assemble } +// GROUPS passed delete +/* + Bug Id: + PRMS Id: p0000710 + Bug is : overloading operator delete in class def not allowed +*/ + +/* + In addition to this bug, the compiler permits overloading operator + delete in the class definition. This is verboten, and should be + caught by a regression suite. In other words, the following is also a + bug that's not caught: +*/ + + +#include + +extern "C" +{ + int printf(const char*, ...); +} + + + +class B +{ + public: + int x; + virtual ~B() {} + void operator delete(void*,size_t s) + { + printf("B::delete() %d\n",s); + } + void operator delete(void*){} +}; + +int main() +{ + B* p = new B; + delete p; + return 0; +}
p710.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p5469.C =================================================================== --- p5469.C (nonexistent) +++ p5469.C (revision 816) @@ -0,0 +1,22 @@ +// { dg-do run } +// prms-id: 5469 + +int count; + +class A { + A(); + A(const A&); +public: + A(int) { ++count; } + ~A() { --count; } + int operator== (const A& r) { return 0; } +}; + +int main() { + { + A a (1); + if (a == 2 && a == 1) + ; + } + return count; +}
p5469.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net32.C =================================================================== --- net32.C (nonexistent) +++ net32.C (revision 816) @@ -0,0 +1,10 @@ +// { dg-do assemble } + +class Co_obj { +public: + Co_obj() {} + }; +class Linear_list_node : virtual public Co_obj { }; +class M1 : public Linear_list_node { }; +class M2 : public Linear_list_node { }; +class New_node : public M1, public M2 { };
net32.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net15.C =================================================================== --- net15.C (nonexistent) +++ net15.C (revision 816) @@ -0,0 +1,47 @@ +// { dg-do run } +// InterViews (ibuild) requires this to work. + +extern "C" void exit(int); + +void *old; + +class c1 +{ + int i; +public: + c1 () {} +}; + +class c2 +{ + int j; +public: + c2 () {} +}; + +class c3 : public c1, public c2 +{ +public: + c3 () + { + old = this; + // printf("new object c3 at %x\n", (int)this); } + } +}; + +c2* f () +{ + c2* n = new c3 (); + // printf ("new object c3 casted to c2 at %x\n", (int)n); + return n; +} + +int main () +{ + c3* o = (c3*)f (); + // printf("new object c3, upcasted from c2 at %x\n", (int)o); + // if old and o are not the same, fail the test case. + if (old != o) + exit(1); + return 0; +}
net15.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh11.C =================================================================== --- eh11.C (nonexistent) +++ eh11.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// { dg-options "-fexceptions" } + +struct A { + ~A(); +}; + +int main(int argc, char** argv) { + A a; + return 0; +} + + +A::~A() { +}
eh11.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: misc14.C =================================================================== --- misc14.C (nonexistent) +++ misc14.C (revision 816) @@ -0,0 +1,28 @@ +// { dg-do run } +// GROUPS passed +extern "C" int printf (const char *, ...); +extern "C" void exit(int); + +class A { +public: + virtual ~A() { + printf("FAIL\n"); + exit (1); + } +}; + +class B : public A { +public: + virtual ~B() { + printf("PASS\n"); + exit (0); + } +}; + +int main() { + B b; + A *ap = &b; + ap->~A(); // This should call the destructor virtually. + printf("FAIL\n"); + return 1; +}
misc14.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: asm2.C =================================================================== --- asm2.C (nonexistent) +++ asm2.C (revision 816) @@ -0,0 +1,25 @@ +// { dg-do run } +// Compile with -S, there should be no references to +// LTRAMP in the output. + +extern "C" int printf (const char *, ...); + +void +sub2 (void (*func) ()) +{ + (*func) (); +} + +int +main(void) +{ + extern void sub (void); + + sub2 (sub); +} + +void +sub (void) +{ + printf ("hello world\n"); +}
asm2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: unused.C =================================================================== --- unused.C (nonexistent) +++ unused.C (revision 816) @@ -0,0 +1,7 @@ +// { dg-do compile { target *-*-darwin* } } +// { dg-options { -Wunused-parameter } } +// Radar 4125055 + +void foo(int x) { +#pragma unused ( x ) +}
unused.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh53.C =================================================================== --- eh53.C (nonexistent) +++ eh53.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions -g" } + +class zeroset { +public: + ~zeroset () { } +}; + +int main () { + zeroset a; + try { + ; + } catch( zeroset ) { + } +}
eh53.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pmf3.C =================================================================== --- pmf3.C (nonexistent) +++ pmf3.C (revision 816) @@ -0,0 +1,20 @@ +// { dg-do assemble } +struct Fooey { + void f(char* pX); + void f(int in); + void f(float fx); + void h(double dx); +}; + +void Fooey::f(char*) { } // { dg-error "" } candidate +void Fooey::f(int) { } // { dg-error "" } candidate +void Fooey::f(float) { } // { dg-error "" } candidate +void Fooey::h(double zahl) { } + +int main() { + Fooey Blah; + void (Fooey::*pointer)(double); + pointer = &Fooey::f; // { dg-error "" } don't call Fooey::h + (Blah.*pointer)(42.5); + return 0; +}
pmf3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh36.C =================================================================== --- eh36.C (nonexistent) +++ eh36.C (revision 816) @@ -0,0 +1,29 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +#include + +class A { + int space; +}; +class B { +public: + int data; + B(int i) : data(i) { + } +}; +class D : public A, public B { +public: + D(int i) : B(i) { + } +} d(42); + +main() { + try { + throw &d; + } catch (B* b) { + if (b->data == 42) + return 0; + } + return 1; +}
eh36.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh19.C =================================================================== --- eh19.C (nonexistent) +++ eh19.C (revision 816) @@ -0,0 +1,23 @@ +// { dg-do assemble } +// { dg-options "-fexceptions" } + +class test1 { +public: + class fehler{public:fehler(){};}; + void func(int a) { + if( a == 0 ) + throw fehler(); + } +}; + +int main() { + test1 var; + + try { + var.func(1); + var.func(0); + } catch(test1::fehler()) // function type promoted to pointer + { + ; + } +}
eh19.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns7.C =================================================================== --- ns7.C (nonexistent) +++ ns7.C (revision 816) @@ -0,0 +1,9 @@ +// { dg-do assemble } + +namespace A { + int i = 1; +} + +namespace B { + int j = i; // { dg-error "" } +}
ns7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net3.C =================================================================== --- net3.C (nonexistent) +++ net3.C (revision 816) @@ -0,0 +1,16 @@ +// { dg-do assemble } +// Here is another program from the net. + +class BOOL { + public: + int val; + + BOOL(int i =0); + operator int(); +}; + +BOOL& foo() +{ + static BOOL status; + return status; +}
net3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: align2.C =================================================================== --- align2.C (nonexistent) +++ align2.C (revision 816) @@ -0,0 +1,17 @@ +// { dg-do run } +class Foo { +}; + +class Bar : virtual Foo { +public: + int b; +} x; + +int main() +{ + // printf("Foo offset %d\n", (int)(Foo*)&x - (int)&x); + // printf("b offset %d\n", (int)&x.b - (int)&x); + // printf("sizeof is %d\n", sizeof(Bar)); + // This core dumps on a SPARC is alignment is wrong. + Bar blist[10]; +}
align2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bool1.C =================================================================== --- bool1.C (nonexistent) +++ bool1.C (revision 816) @@ -0,0 +1,16 @@ +// { dg-do assemble } +// bool test case + + +void foo(int i) { + foo (true); +} + +struct C { + void foo(int i) { + foo(true); + } + void bar(bool b) { + bar(0); + } +};
bool1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh2.C =================================================================== --- eh2.C (nonexistent) +++ eh2.C (revision 816) @@ -0,0 +1,74 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +#include +#include + +class Vector { +private: + int *p; + int sz; + +public: + // Exception class + class Range { + private: + int value_i; + + public: + Range( int i ) { value_i = i; }; + int value() { return value_i; }; + }; + + Vector( int s ); + ~Vector(); + int size() { return sz; }; + int& operator []( int i ); +}; + +Vector::Vector(int s) { + sz = s; + p = new int[sz]; +} + +Vector::~Vector() { + delete [] p; +} + +int& +Vector::operator [](int i) { + if (0<=i && i
eh2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3139.C =================================================================== --- p3139.C (nonexistent) +++ p3139.C (revision 816) @@ -0,0 +1,26 @@ +// { dg-do run } +// prms-id: 3139 + +extern "C" int printf(const char *, ...); + +class A { + public: + A() { } + virtual int a() = 0; +}; + +class B : virtual public A { + public: + virtual int a() = 0; +}; + +class C : public B { + public: + int a() { return 42; } +}; + +int main() { + B * b = new C; + printf("%d.\n", b->a()); + return 0; +}
p3139.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p7912.C =================================================================== --- p7912.C (nonexistent) +++ p7912.C (revision 816) @@ -0,0 +1,23 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } +// prms-id: 7912 + +int count = 0; + +class Foo { +public: + Foo() { ++count; }; + Foo(const Foo&) { ++count; }; + ~Foo() { --count; }; +}; + + +main() +{ + try { + throw Foo(); + } + catch (Foo object) { + } + return count; +}
p7912.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: opr-as1.C =================================================================== --- opr-as1.C (nonexistent) +++ opr-as1.C (revision 816) @@ -0,0 +1,12 @@ +// { dg-do run } +// Shows a problem with the default op= not being an implementation... + +class C { + int i; +}; + +C a, b; + +int main() { + a = b; +}
opr-as1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p2746.C =================================================================== --- p2746.C (nonexistent) +++ p2746.C (revision 816) @@ -0,0 +1,156 @@ +// { dg-do assemble } +// GROUPS passed scope pt +class Link { +public: + Link(); + Link(Link *); +private: + Link *next_; + +friend class IListBase; +friend class IListIterBase; +}; + +inline +Link::Link() : next_(0) +{ +} + +inline +Link::Link(Link *next) : next_(next) +{ +} + +class IListBase { +public: + IListBase(); + IListBase(Link *); + void append(Link *); + void insert(Link *); + Link *head(); + int empty(); + Link *get(); + void remove(Link *); +private: + Link *head_; +friend class IListIterBase; +}; + +inline +IListBase::IListBase() : head_(0) +{ +} + +inline +IListBase::IListBase(Link *head) : head_(head) +{ +} + +inline +void IListBase::insert(Link *p) +{ + p->next_ = head_; + head_ = p; +} + +inline +Link *IListBase::head() +{ + return head_; +} + +inline +int IListBase::empty() +{ + return head_ == 0; +} + +inline +Link *IListBase::get() +{ + Link *tem = head_; + head_ = head_->next_; + return tem; +} + +template class IListIter; + +template +class IList : private IListBase { +public: + IList() { } + IList(T *p) : IListBase(p) { } + ~IList(); + void append(T *p) { IListBase::append(p); } + void insert(T *p) { IListBase::insert(p); } + void remove(T *p) { IListBase::remove(p); } + T *head() { return (T *)IListBase::head(); } + T *get() { return (T *)IListBase::get(); } + IListBase::empty; +friend class IListIter; +}; + +template +IList::~IList() +{ + while (!empty()) + delete get(); +} + +class IListIterBase { +public: + IListIterBase(const IListBase &); + int done(); + Link *cur(); + void next(); +private: + Link *p_; +}; + +inline +IListIterBase::IListIterBase(const IListBase &list) : p_(list.head_) +{ +} + +inline +int IListIterBase::done() +{ + return p_ == 0; +} + +inline +Link *IListIterBase::cur() +{ + return p_; +} + +inline +void IListIterBase::next() +{ + p_ = p_->next_; +} + + +template +class IListIter : private IListIterBase { +public: + IListIter(const IList &list) : IListIterBase(list) { } + T *cur() { return (T *)IListIterBase::cur(); } + IListIterBase::next; + IListIterBase::done; +}; + + +struct A { + IList list; + int x; + void foo(); +}; + + +void A::foo() +{ + for (IListIter iter(list); !iter.done(); iter.next()) + ; + x = 0; +}
p2746.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p7635.C =================================================================== --- p7635.C (nonexistent) +++ p7635.C (revision 816) @@ -0,0 +1,7 @@ +// { dg-do assemble } +// prms-id: 7635 + +class DaycountBasis { + mutable const int * p; + mutable int * const q; // { dg-error "" } +};
p7635.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4736a.C =================================================================== --- p4736a.C (nonexistent) +++ p4736a.C (revision 816) @@ -0,0 +1,40 @@ +// { dg-do run } +// prms-id: 4736 + +int did_fail = 1; + +class O { +public: + virtual void of() { } +}; + +class A : public O { +public: + virtual void vf() { } +}; + +class W { +public: + virtual void vf() { } +}; + +class X : public W, public A { +public: + virtual void vf() { } +}; + +class Z : public X { +public: + virtual void vf() { did_fail = 0; } +}; + +Z sz; + +void fail1(W* w) { + w->vf(); +} + +int main() { + fail1 (&sz); + return did_fail; +}
p4736a.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: conv1.C =================================================================== --- conv1.C (nonexistent) +++ conv1.C (revision 816) @@ -0,0 +1,11 @@ +// { dg-do run } +enum E { C }; + +E foo() { + return C; +} + +int main() { + if (foo() != C) + return 1; +}
conv1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dyncast1.C =================================================================== --- dyncast1.C (nonexistent) +++ dyncast1.C (revision 816) @@ -0,0 +1,22 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions -w" } + +#include + +struct B { + virtual int f() { } +}; + +struct D { + virtual int f() { } +}; + +main() { + B b; + try { + (void)dynamic_cast(b); + } catch (std::bad_cast) { + return 0; + } + return 1; +}
dyncast1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: warn4.C =================================================================== --- warn4.C (nonexistent) +++ warn4.C (revision 816) @@ -0,0 +1,2 @@ +// { dg-do assemble } +void foo (int a, int a) { } // { dg-error "" }
warn4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net41.C =================================================================== --- net41.C (nonexistent) +++ net41.C (revision 816) @@ -0,0 +1,4 @@ +// { dg-do run } +int main() { + int i = ~ false; +}
net41.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net24.C =================================================================== --- net24.C (nonexistent) +++ net24.C (revision 816) @@ -0,0 +1,3 @@ +// { dg-do assemble } + + char HexDigit(unsigned char ch) { return ch < 'f'; }
net24.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: scast1.C =================================================================== --- scast1.C (nonexistent) +++ scast1.C (revision 816) @@ -0,0 +1,8 @@ +// { dg-do assemble } +class A {}; +class C {}; + +int main() { + A* a = 0; + C* c = static_cast(a); // { dg-error "" } bad static cast +}
scast1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh20.C =================================================================== --- eh20.C (nonexistent) +++ eh20.C (revision 816) @@ -0,0 +1,7 @@ +// { dg-do assemble } +// { dg-options "-fexceptions -Wall" } + +int +main() { + throw 1; +}
eh20.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dyncast9.C =================================================================== --- dyncast9.C (nonexistent) +++ dyncast9.C (revision 816) @@ -0,0 +1,17 @@ +// { dg-do run } +class S1 { int i; }; +class S2 { int i; }; +class VB { +public: + virtual void foo() { } +}; + +class D : public S1, virtual public VB { +} d; + +class E : public S2, public D { +} e; + +int main() { + return (char *)&e - (char *)dynamic_cast((D*)&e); +}
dyncast9.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p646.C =================================================================== --- p646.C (nonexistent) +++ p646.C (revision 816) @@ -0,0 +1,163 @@ +// { dg-do assemble } +// { dg-options "-Wno-deprecated -Wreturn-type" } +// GROUPS passed i960 +/* + Bug Id: bnr + PMRS Id: p0000646 + Bug is: Urgent Code Generation Problem in gcc-i960 V 1.95 +*/ + + + +extern "C" +{ + int printf (const char *, ...); + void abort (); +} + +struct foo +{ + static int si; + int i; + foo (); + foo (const foo&); + ~foo (); +}; + +int +foo_parm_returns_i (foo foo_arg) +{ + return foo_arg.i; +} + +int foo::si = 0; + +foo::foo () +{ + si++; + printf ("new foo @ 0x%x; now %d foos\n", this, si); +} + +foo::foo (const foo &other) +{ + si++; + printf ("another foo @ 0x%x; now %d foos\n", this, si); + *this = other; +} + +foo::~foo () +{ + si--; + printf ("deleted foo @ 0x%x; now %d foos\n", this, si); +} + +int +return_1 () +{ + foo f; + printf ("returning 1\n"); + return 1; +} + +int +return_arg (int arg) +{ + foo f; + printf ("returning %d\n", arg); + return arg; +} + +int +return_sum (int x, int y) +{ + foo f; + printf ("returning %d+%d\n", x, y); + return x + y; +} + +foo +return_foo () +{ + foo f; + printf ("returning foo\n"); + return f; +} + +foo +foo_parm_returns_foo (foo f) +{ + return f; +} + +void +abort_because (const char *str) +{ + printf ("aborting because %s\n", str); + abort (); +} + +int +warn_return_1 () +{ + foo f; + printf ("returning 1\n"); +} // { dg-warning "" } control reaches end + +int +warn_return_arg (int arg) +{ + foo f; + printf ("returning %d\n", arg); + arg; +} // { dg-warning "" } control reaches end + +int +warn_return_sum (int x, int y) +{ + foo f; + printf ("returning %d+%d\n", x, y); + x + y; +} // { dg-warning "" } control reaches end + +foo +warn_return_foo () +{ + foo f; + printf ("returning foo\n"); +} // { dg-warning "" } control reaches end + +foo +warn_foo_parm_returns_foo (foo f) +{ + f; +} // { dg-warning "" } control reaches end + +main () // { dg-warning "" } no type +{ + int ii = return_1 (); + if (ii != 1) + abort_because ("wrong value returned"); + int j = return_arg (42); + if (j != 42) + abort_because ("wrong value returned"); + int k = return_sum (-69, 69); + if (k != 0) + abort_because ("wrong value returned"); + foo f1 = return_foo (); + if (foo::si != 1) + abort_because ("wrong number of foos"); + f1.i = 5; + int l = foo_parm_returns_i (f1); + if (l != 5) + abort_because ("l != 5"); + foo f2 = foo_parm_returns_foo (f1); + if (foo::si != 2) + abort_because ("wrong number of foos"); + if (f2.i != 5) + abort_because ("f2.i != 5"); + foo f3 = return_foo (); + if (foo::si != 3) + abort_because ("wrong number of foos"); + printf("PASS\n"); + return 0; +}
p646.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p786.C =================================================================== --- p786.C (nonexistent) +++ p786.C (revision 816) @@ -0,0 +1,36 @@ +// { dg-do run } +// prms-id: 786 + +extern "C" int printf (const char *, ...); +extern "C" void exit(int); +class C + { + int a; +public: + C() {a = 1;} + }; + +void func(const C& a, C& b) +{ + printf ("in const func\n"); + exit(1); +} + +void func(C& a, C& b) +{ + printf ("in non-const func\n"); +} + +void testit(const C& a, C& b) +{ + func(a,b); +} + +int main() +{ + C a; + C b; + + func(a,b); + return 0; +}
p786.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pt2.C =================================================================== --- pt2.C (nonexistent) +++ pt2.C (revision 816) @@ -0,0 +1,23 @@ +// { dg-do run } +class A { +public: +}; + +template +class B: public virtual A { +public: + B (); + ~B (); +}; + +template +B::B () { } + +template +B::~B () { } + +int main () { + B ab; + + return 0; +}
pt2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh45.C =================================================================== --- eh45.C (nonexistent) +++ eh45.C (revision 816) @@ -0,0 +1,35 @@ +// { dg-do run } +int i; +int fail; + +class ca { +public: + ca() { + if (++i != 1) + fail = 1; + } + virtual ~ca() { + if (++i != 4) + fail = 4; + } +}; + +class cb { +public: + cb(const ca &rca) { + if (++i != 2) + fail = 2; + } + virtual ~cb() { + if (++i != 3) + fail = 3; + } +}; + +void foo(const cb &rcb) { +} + +int main(int argc, char **argv) { + foo(cb(ca())); + return fail; +}
eh45.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: opr-dot1.C =================================================================== --- opr-dot1.C (nonexistent) +++ opr-dot1.C (revision 816) @@ -0,0 +1,22 @@ +// { dg-do assemble } + +typedef struct base1 { + int x; +} base1_t; + +typedef struct base2 { + int x; +} base2_t; + +class derived1 : public base1 { +}; + +class derived2 : public derived1, public base2 { +}; + +struct test { + derived2& fails; + void test1() { + fails.base1::x = 5; + } +};
opr-dot1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: virt2.C =================================================================== --- virt2.C (nonexistent) +++ virt2.C (revision 816) @@ -0,0 +1,26 @@ +// { dg-do run } +struct S0 { + virtual int is_kind_of_S1 () const { return 0; } + virtual void dummy () { } +}; + +struct S1 : virtual public S0 { + virtual int is_kind_of_S1 () const { return 1; } + virtual void dummy () { } +}; + +struct S2 : virtual public S0 { + virtual void dummy () { } +}; + +struct S3 : public S2, public S1 { + virtual void dummy () { } +}; + +static struct S0 *var = new S3 (); + +int main () { + if (var->is_kind_of_S1() != 1) + return 1; + return 0; +}
virt2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh28.C =================================================================== --- eh28.C (nonexistent) +++ eh28.C (revision 816) @@ -0,0 +1,17 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +#include + +int fail = 1; + +class X { public: virtual void p() { } }; +class Y : public X { public: virtual void p() { fail = 0; } }; + +main() +{ + try { Y y; throw y; } + catch (X& x) { x.p(); } + catch (...) { } + return fail; +}
eh28.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p6311.C =================================================================== --- p6311.C (nonexistent) +++ p6311.C (revision 816) @@ -0,0 +1,17 @@ +// { dg-do run } +// prms-id: 6311 + +struct Foo { + int member; +} a = { 42 }, *ptra = &a; + +int Foo::*pmd = &Foo::member; + +int main() { + if (pmd == 0) + return 1; + if (a.*pmd != 42) + return 2; + if (ptra->*pmd != 42) + return 3; +}
p6311.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: err3.C =================================================================== --- err3.C (nonexistent) +++ err3.C (revision 816) @@ -0,0 +1,10 @@ +// { dg-do assemble } +class cb { +}; + +class cc { +public: + cc() + : cb() { // { dg-error "" } + } +};
err3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p7180.C =================================================================== --- p7180.C (nonexistent) +++ p7180.C (revision 816) @@ -0,0 +1,18 @@ +// { dg-do run } +// prms-id: 7180 + +class String { +public: + String(const char*); + ~String(); +}; + +String::String(const char* str = "") { +} + +String::~String(void) { +} + +int main() { + const String array[] = {"3"}; +}
p7180.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4750.C =================================================================== --- p4750.C (nonexistent) +++ p4750.C (revision 816) @@ -0,0 +1,10 @@ +// { dg-do assemble { target native } } +// { dg-options "-fpic -pedantic-errors -S" } +// prms-id: 4750 + +extern const int FRAME_VEC_MAX; + +const int FRAME_VEC_MAX = 12; +int frame_vec_sizes[FRAME_VEC_MAX+1] = { + 0, 1, 3, 3, 6, 6, 6, 9, 9, 9, 12, 12, 12 +};
p4750.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: misc5.C =================================================================== --- misc5.C (nonexistent) +++ misc5.C (revision 816) @@ -0,0 +1,11 @@ +// { dg-do assemble } +// GROUPS uncaught +// Cfront bug A.3 (See Language System Release Notes for the +// SPARCompiler C++ version 3.0) + +struct S1 { + static int S1; // { dg-error "" } uses same name 9.3 +}; +struct S2 { + union { int ii; float S2; }; // { dg-error "" } uses same name 9.3 +};
misc5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p9068.C =================================================================== --- p9068.C (nonexistent) +++ p9068.C (revision 816) @@ -0,0 +1,22 @@ +// { dg-do assemble } +// prms-id: 9068 + +struct ostream { + void operator<< (int); // { dg-error "" } fn ref in err msg +}; + +class C { +public: + static int& i (); + static int& i (int signatureDummy); +}; + +void foo (ostream& lhs, const C& rhs) +{ + lhs << rhs.i; // { dg-error "" } no such i for any opr << () +} + +int& C::i () { + static int _i = 4711; + return _i; +}
p9068.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi1.C =================================================================== --- mi1.C (nonexistent) +++ mi1.C (revision 816) @@ -0,0 +1,45 @@ +// { dg-do run } +// { dg-options "-w" } + +class A { +public: + virtual ~A(){}; + virtual int type(void) { + return -1; + } +}; + +class B : public A { +public: + virtual ~B(){}; +}; + + +class C0 : public B, public virtual A { +public: + virtual int type(void) { + return 0; + } +}; + +class C1 : public C0 +{ +public: + virtual int type(void) { + return 1; + } +}; + +class C2 : public C0 { +public: + virtual int type(void) { + return 2; + } +}; + +main() { + C1 *one = new C1; + + if (one->type() != 1) + return 1; +}
mi1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns15.C =================================================================== --- ns15.C (nonexistent) +++ ns15.C (revision 816) @@ -0,0 +1,31 @@ +// { dg-do assemble { xfail xstormy16-*-* } } + +#include +#include + +#define MAX 256 +#define MAXSTATE 1000000 + +struct R { + int count; + int state1; + int state2; +}; + +int cmp_d(const R* a, const R* b) { + return a->count > b->count; +} + +namespace CXX { + template + inline void qsort (T b[i1][i2], int (*cmp)(const T*, const T*)) { + ::qsort ((void*)b, i1*i2, sizeof(T), (int (*)(const void *, const void *))cmp); + } +} + +using namespace CXX; + +void sort_machine() { + struct R d[MAX][MAX]; + qsort (d, cmp_d); +}
ns15.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4677.C =================================================================== --- p4677.C (nonexistent) +++ p4677.C (revision 816) @@ -0,0 +1,9 @@ +// { dg-do assemble } +// prms-id: 4677 + +struct A { + A(double d) { } +}; + +struct B { B(A) { } } bad = 1; // { dg-error "" } +B good (1);
p4677.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p7865.C =================================================================== --- p7865.C (nonexistent) +++ p7865.C (revision 816) @@ -0,0 +1,29 @@ +// { dg-do run } +// prms-id: 7865 + +int count; + +struct A { + A() { ++count; } + ~A() { --count; } +}; + +int foo() { return 1; } + +int bar() +{ + A a; + for (;;) { + A b; + if (foo()) + return 0; + if (foo()) + return 0; + } + return 0; +} + +int main() { + bar(); + return count; +}
p7865.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net16.C =================================================================== --- net16.C (nonexistent) +++ net16.C (revision 816) @@ -0,0 +1,8 @@ +// { dg-do run } +// On an i386, this core dumps because the reg-stack.c code is wrong, and +// pops an fp register that it thinks is not used, but it is. + +extern "C" int printf (const char*, ...); +struct S { ~S () { } }; +double f (S) { return 5; } +int main() { S s; double dist = f (s); printf ("%g\n", dist); return 0; }
net16.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh12.C =================================================================== --- eh12.C (nonexistent) +++ eh12.C (revision 816) @@ -0,0 +1,14 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +class MyError { }; + +int main (int argc, char **argv) { + try { + throw MyError(); + } + catch (MyError x) { + } + + return 0; +}
eh12.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p991.C =================================================================== --- p991.C (nonexistent) +++ p991.C (revision 816) @@ -0,0 +1,22 @@ +// { dg-do assemble } +// prms-id: 991 + +class Complex { +public: + double re; + double im; + Complex(double r,double i) : re(r), im(i) {} +}; + +Complex cos(const Complex&); + +extern "C" double cos (double); // not the same as the above +extern "C" double cosh (double); +extern "C" double sin (double); +extern "C" double sinh (double); + +Complex cos(const Complex& arg) { + double nr = cos(arg.re)*cosh(arg.im); + double ni = -sin(arg.re)*sinh(arg.im); + return Complex(nr,ni); +}
p991.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p783a.C =================================================================== --- p783a.C (nonexistent) +++ p783a.C (revision 816) @@ -0,0 +1,27 @@ +// { dg-do run } +// Copying into an object directly is a lose according to tiemann. +// Deleting an object many times is a lose. +// prms-id: 783 + +extern "C" int printf (const char *, ...); +extern "C" void exit (int); + +class C { + int i; +public: + C() { + i = 1; + } + ~C() { + if (i != 1) { + exit(1); + } + i = 0; + } +}; + +int main(int argc, char**argv) { + C c; + c = C(); + return 0; +}
p783a.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh54.C =================================================================== --- eh54.C (nonexistent) +++ eh54.C (revision 816) @@ -0,0 +1,4 @@ +// { dg-do assemble } +// { dg-options "-fexceptions" } + +int main() { try { 1; } } // { dg-error "" }
eh54.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pmf4.C =================================================================== --- pmf4.C (nonexistent) +++ pmf4.C (revision 816) @@ -0,0 +1,13 @@ +// { dg-do assemble } + +class NF { }; + +struct QF { + NF nf; + + typedef float(NF::* const NPF)() const; + + void p (NPF npf) const { + float q = (nf.*npf)(); + } +};
pmf4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh37.C =================================================================== --- eh37.C (nonexistent) +++ eh37.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +#include + +class B { +public: + int data; + B(int i) : data(i) { + } +} b(42); + +main() { + try { + throw &b; + } catch (B* b) { + if (b->data == 42) + return 0; + } + return 1; +}
eh37.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4104.C =================================================================== --- p4104.C (nonexistent) +++ p4104.C (revision 816) @@ -0,0 +1,16 @@ +// { dg-do run } +// prms-id: 4104 + +template +void F(T &a, void (*P)(T &temp)) { + (*P)(a); +} + +template +void G(T &a) { +} + +int main() { + int a; + F(a, G); +}
p4104.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net4.C =================================================================== --- net4.C (nonexistent) +++ net4.C (revision 816) @@ -0,0 +1,32 @@ +// { dg-do assemble } +// Message-Id: +// Date: Wed, 4 Mar 92 12:50 MET +// From: niklas@appli.se (Niklas Hallqvist) +// To: eichin@cygnus.com, tiemann@cygnus.com +// Cc: gcc2@cygnus.com +// Subject: nested type handling +// +// The last couple of days I've been struggling with nested types in the +// C++ compiler. Frankly, it's a mess! Was it impossible to put the stuff +// into the parser instead of the lexer? Well, anyway, to get the following +// code to compile: +// +// struct O { +// struct M { +// struct I +// {}; +// }; +// }; +// O::M::I s; +// +// a patch enclosed below is needed. I'm not sure if it causes any +// unanticipated side-effects, but it seem to work well for me. + + +struct O { + struct M { + struct I + {}; + }; +}; +O::M::I s;
net4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bool2.C =================================================================== --- bool2.C (nonexistent) +++ bool2.C (revision 816) @@ -0,0 +1,58 @@ +// { dg-do run } +// { dg-options "" } +class A { +public: + operator bool () { + return true; + } +} a; +class A1 { +public: + operator int () { + return true; + } +} a1; +class A2 { +public: + operator const char * () { + return ""; + } +} a2; +class A3 { +public: + operator unsigned long long int () { + return true; + } +} a3; +class A4 { +public: + operator const char * () { + return ""; + } + operator unsigned long long int () { + return true; + } +} a4; +class A5 { +public: + operator double () { + return 256.0e0*256.0e0*256.0e0*256.0e0*256.0e0*256.0e0*256.0e0*256.0e0 + *256.0e0*256.0e0*256.0e0*256.0e0*256.0e0*256.0e0*256.0e0*256.0e0 + *256.0e0*256.0e0*256.0e0*256.0e0*256.0e0*256.0e0*256.0e0*256.0e0 + *256.0e0*256.0e0*256.0e0*256.0e0*256.0e0*256.0e0*256.0e0*256.0e0; + } +} a5; +int i = true; +bool b = true; +bool c = (bool)(void (A::*)())0; +bool d = 256; +main() { + if (!d) return 1; + if (!a) return 1; + if (!(bool)a) return 1; + // if (!(long long)a) return 1; + if (!a1) return 1; + if (!a2) return 1; + if (!a3) return 1; + if (!a5) return 1; +}
bool2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh3.C =================================================================== --- eh3.C (nonexistent) +++ eh3.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +class foo { +public: + class error {}; + + void cause_error(void) { throw error(); } +}; + +int main(void) +{ + foo f; + try { + f.cause_error(); + } + catch (foo::error&) { + return 0; + } + return 1; +}
eh3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p2960.C =================================================================== --- p2960.C (nonexistent) +++ p2960.C (revision 816) @@ -0,0 +1,31 @@ +// { dg-do run } +// prms-id: 2960 + +extern "C" int printf(const char *, ...); + +class Test0 { +public: + virtual void f0() { } // works fine if this virtual removed +}; + +class Test1 : public Test0 { +public: + void f1() { f2(); } // generates bus error here + virtual void f2() { printf("Test1::f2\n"); } +}; + +class Test2 { +public: + virtual void f3() { } +}; + +class Test3 : public Test2, public Test1 { // works fine if Test1 first +public: + virtual ~Test3() { f1(); } // calling f2 directly works + virtual void f2() { printf("Test3::f2\n"); } +}; + +int main() { + Test3 t3; + return 0; +}
p2960.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p8804.C =================================================================== --- p8804.C (nonexistent) +++ p8804.C (revision 816) @@ -0,0 +1,19 @@ +// { dg-do run } +// prms-id: 8804 + +extern "C" int printf (const char *, ...); + +struct Fails { + int i; + union { + union { + int c; + }; + }; +}; + +Fails d; + +int main() { + return &d.i == &d.c; +}
p8804.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p6149.C =================================================================== --- p6149.C (nonexistent) +++ p6149.C (revision 816) @@ -0,0 +1,4 @@ +// { dg-do assemble } +// prms-id: 6149 + +int a[3 - sizeof(double)]; // { dg-error "" }
p6149.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4736b.C =================================================================== --- p4736b.C (nonexistent) +++ p4736b.C (revision 816) @@ -0,0 +1,49 @@ +// { dg-do run } +// prms-id: 4736 + +class Rep { +public: + virtual int foo() { return 1; } +}; + +class Rep_1 : public Rep { +}; + +class VBaseMain { +public: + virtual int foo() { return 2; } +}; + +class OtherVBase { +public: + virtual int foo() { return 3; } +}; + +class Rep_2 : public Rep { +}; + +class DVBase : public VBaseMain, public Rep_2, public OtherVBase { +public: + virtual int foo() { return 4; } +}; + +class Main : public Rep_1, virtual public DVBase { +public: + virtual int foo() { return 5; } +}; + +int main() { + Main m; + if (m.foo() != 5) + return 1; + if (((Rep*)(Rep_1*)&m)->foo() != 5) + return 2; + if (((DVBase*)&m)->foo() != 5) + return 3; + if (((VBaseMain*)(DVBase*)&m)->foo() != 5) + return 4; + if (((Rep*)(Rep_2*)(DVBase*)&m)->foo() != 5) + return 5; + if (((OtherVBase*)(DVBase*)&m)->foo() != 5) + return 6; +}
p4736b.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p9732a.C =================================================================== --- p9732a.C (nonexistent) +++ p9732a.C (revision 816) @@ -0,0 +1,37 @@ +// { dg-do run } +// prms-id: 9732 + +class A { + int i; +public: + A() { i = 1; } + ~A() { } +}; + +struct value { + A x,y,z; +}; + +int crash(const value* capt, value* jet) { + return capt == jet; +} + +class euler { +public: + value number() const { return _value; } + int distance(); + +private: + value _value; +}; + +int euler::distance() { + const value& capt = number(); + value jet; + return crash (&capt, &jet); +} + +int main() { + euler e; + return e.distance(); +}
p9732a.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p10511.C =================================================================== --- p10511.C (nonexistent) +++ p10511.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// prms-id: 10511 + +class S { +public: + enum E {a, b, c}; +}; + +class C { +public: + bool f (S::E()) { return true; } + virtual void foo(); +}; + +void C::foo() { }
p10511.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dyncast2.C =================================================================== --- dyncast2.C (nonexistent) +++ dyncast2.C (revision 816) @@ -0,0 +1,25 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions -w" } + +// Ensure reference handling works. + +#include + +struct B { + virtual int f() { } +} ob; + +struct D : public B { + virtual int f() { } +} od; + +main() { + B *b=&ob; + try { + void *vp = &dynamic_cast(*b); + return 1; + } catch (std::bad_cast) { + return 0; + } + return 1; +}
dyncast2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p11142.C =================================================================== --- p11142.C (nonexistent) +++ p11142.C (revision 816) @@ -0,0 +1,18 @@ +// { dg-do assemble } +// { dg-options "-fexceptions -O -g" } +// prms-id: 11142 + +class RWxmsg { +public: + RWxmsg(); + virtual ~RWxmsg(); +}; + +class RWTHRInternalError : public RWxmsg { +public: + virtual ~RWTHRInternalError() { } +}; + +void setCount(int count) { + throw RWTHRInternalError(); +}
p11142.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net42.C =================================================================== --- net42.C (nonexistent) +++ net42.C (revision 816) @@ -0,0 +1,25 @@ +// { dg-do assemble } + +typedef void (*__sighandler_t)(int); + +struct sigaction { + __sighandler_t sa_handler; +}; + +struct task_struct { + struct sigaction sigaction[32]; +}; + +void +get_stat() { + struct task_struct ** p = 0; + unsigned long bit = 1; + unsigned long sigignore = 0; + int i = 0; + switch((__SIZE_TYPE__) (*p)->sigaction[i].sa_handler) + { + case 1: + sigignore |= bit; + break; + } +}
net42.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: warn5.C =================================================================== --- warn5.C (nonexistent) +++ warn5.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// { dg-options "-Wpointer-arith" } + +double X(const double x) { return x; } +double Y() { return 1.0; } +double Z() { return 2.0; } + +struct A { + void bar() { } + void foo() { } +}; + +typedef void (A::*pmf)(); + +static int mememe = &A::foo - &A::bar; // { dg-warning "" } +pmf b = &A::foo-1; // { dg-warning "" } + +int main() { + double y; + y=X(Y-Z); // { dg-warning "" } +}
warn5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net25.C =================================================================== --- net25.C (nonexistent) +++ net25.C (revision 816) @@ -0,0 +1,17 @@ +// { dg-do assemble } + +void shake_zero() +{ +} + +void shake_one() +{ +} + +void (*foo)(); + +int main(int a) +{ + foo = a ? shake_zero : shake_one; + return 0; +}
net25.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh21.C =================================================================== --- eh21.C (nonexistent) +++ eh21.C (revision 816) @@ -0,0 +1,14 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +int main () { + try { + try { + throw 1; + } catch ( char * ) { + } + } catch ( int ) { + return 0; + } + return 1; +}
eh21.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p807a.C =================================================================== --- p807a.C (nonexistent) +++ p807a.C (revision 816) @@ -0,0 +1,22 @@ +// { dg-do assemble } +// prms-id: 807 + +// See ARM page 275 Section 12.3.2 + +extern "C" int printf (const char *, ...); +extern "C" void exit(int); + +class B; + +class A { +public: + A(B&); // { dg-error "" } fn ref in err msg +}; + +class B { +public: + operator A(); // { dg-error "" } fn ref in err msg +}; + +B b; +A a = b; // { dg-error "" } should fail as it is ambigious.
p807a.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p10849a.C =================================================================== --- p10849a.C (nonexistent) +++ p10849a.C (revision 816) @@ -0,0 +1,34 @@ +// { dg-do run } +// prms-id: 10849 + +struct A +{ + int comm; + A(int i) : comm(i) { } +}; + +struct S1 { char c1; }; + +struct B : public S1, public A +{ + B(int i) : A(i) { } +}; + +struct C : public A +{ + C(int i) : A(i) { } +}; + +struct D : public B, public C +{ + virtual int g() { + int D::*pmd = (int C::*)&C::comm; + return (this->*pmd) == 42; + } + D() : B(41), C(42) { } +} d; + +int main() { + if (! d.g()) + return 1; +}
p10849a.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh46.C =================================================================== --- eh46.C (nonexistent) +++ eh46.C (revision 816) @@ -0,0 +1,46 @@ +// { dg-do assemble { xfail arm-*-pe } } +// { dg-options "-fexceptions" } + +int atoi(const char *); + +struct ios { + virtual ~ios(); +}; + +class fstreambase : virtual public ios { +}; + +class ifstream : public fstreambase { +}; + +class ofstream : public fstreambase { +}; + +extern const short O; +extern const short D; + +const short O= 0; +const short D= -3; + + +short glc(const char* const * const l, + short& n,short& x,short& y, + ifstream* i,ofstream* o) + +{ + n=atoi(l[1]); + + x=atoi(l[2]); + y=atoi(l[3]); + + if((x < 0)||(y <0)) + { + return D; + } + + i = new ifstream[n]; + o = new ofstream[2]; + + return O; + +}
eh46.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pt3.C =================================================================== --- pt3.C (nonexistent) +++ pt3.C (revision 816) @@ -0,0 +1,29 @@ +// { dg-do assemble } + +template +class syHandle +{ +protected: + syHandle(); + ~syHandle(); + Repr *_repr; +}; + +template +syHandle::~syHandle() +{ +} + +typedef char * char_ptr_t; + +template <> +syHandle::syHandle() +{ + _repr = 0; +} + +template <> +syHandle::~syHandle() +{ + _repr = 0; +}
pt3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh29.C =================================================================== --- eh29.C (nonexistent) +++ eh29.C (revision 816) @@ -0,0 +1,27 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +int count; + +class A { +public: + A() { +// printf("ctor %x\n", (int)this); + if (count==3) + throw 1; + ++count; + } + ~A() { + --count; +// printf("dtor %x\n", (int)this); + } +}; + +main() { + try { + A a[5]; + } catch (...) { + return count; + } + return 1; +}
eh29.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: virt3.C =================================================================== --- virt3.C (nonexistent) +++ virt3.C (revision 816) @@ -0,0 +1,17 @@ +// { dg-do assemble } + +class B { +public: + int Bi; + virtual int g() { return 0; }; +}; + +class D : private B { + int Di; +}; + +class E : public virtual D, public B { // { dg-warning "" } direct base inaccessible due to ambiguity + int Ei; +}; + +E e;
virt3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3068.C =================================================================== --- p3068.C (nonexistent) +++ p3068.C (revision 816) @@ -0,0 +1,61 @@ +// { dg-do run } +// prms-id: 3068 + +extern "C" int printf(const char *, ...); +extern "C" void exit(int); + +class LB { +public: + virtual int test() { return 0; } + virtual ~LB() { } +protected: + LB() { } +}; + +class RRB { +public: + virtual ~RRB() { } + virtual void test2(int a) { } +}; + +class RR : public RRB { +public: + virtual ~RR() { } +}; + +class RL { +public: + virtual void real(int a) { + printf("RL::real\n"); + } +}; + + +class R : public RL, public RR { +public: + virtual void test3(int a) { } + virtual void test2(int a) { } +}; + +class L : public LB { +}; + +class C : public L, public R { +public: + C() { } + virtual ~C() { + printf("C::~C\n"); + exit(1); + } + virtual void real(int a) { + printf("RL::real\n"); + } +}; + +int main() { + C& bb = *new C; + R& mv = bb; + bb.real(0); + mv.real(0); + return 0; +}
p3068.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p9206.C =================================================================== --- p9206.C (nonexistent) +++ p9206.C (revision 816) @@ -0,0 +1,22 @@ +// { dg-do run } +// prms-id: 9206 + +class X { +public: + void xtest() { } +}; + +class Y { }; + +typedef void (X::*Xptr)(); +typedef void (Y::*Yptr)(); + +int main() { + X xx; + + Xptr xp = &X::xtest; + Yptr yp = reinterpret_cast(xp); + xp = reinterpret_cast(yp); + + (xx.*xp)(); +}
p9206.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: misc6.C =================================================================== --- misc6.C (nonexistent) +++ misc6.C (revision 816) @@ -0,0 +1,11 @@ +// { dg-do assemble } +// GROUPS uncaught +// Cfront bug A.4 (See Language System Release Notes for the +// SPARCompiler C++ version 3.0) + +struct assign { + assign& operator = (const assign&); +}; +union U { + assign a; // { dg-error "" } member of union cannot have op= 9.4// ERROR - .* +};
misc6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4619.C =================================================================== --- p4619.C (nonexistent) +++ p4619.C (revision 816) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// prms-id: 4619 + +int main() { + int i = 3; + int (*p)[10] = new int [20][10]; + int (*p1)[5][7][13][10] = new int [i][5][7][13][10]; + delete [] p1; + delete [] p; +}
p4619.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi2.C =================================================================== --- mi2.C (nonexistent) +++ mi2.C (revision 816) @@ -0,0 +1,47 @@ +// { dg-do run } +class A { + char a; +public: + A(char x) : a(x) { } + virtual ~A() { } +}; + +class B : virtual public A { + char b; +public: + B(char x) : A('b'), b(x) { } + ~B() { } +}; + +class C : virtual public A { + char c; +public: + C(char x) : A('c'), c(x) { } + ~C() { } +}; + +class D : virtual public A, public B, public C { + char d; +public: + D(char x) : A('d'), B('d'), C('d'), d(x) { } + ~D() { } +}; + +class E : virtual public A, public B, public C { + char e; +public: + E(char x) : A('e'), B('e'), C('e'), e(x) { } + ~E() { } +}; + +class F : virtual public A, public D, public E { + char f; +public: + F(char x) : A('f'), D('f'), E('f'), f(x) { } + ~F() { } +}; + +int main() { + F f('x'); + return 0; +}
mi2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p418.C =================================================================== --- p418.C (nonexistent) +++ p418.C (revision 816) @@ -0,0 +1,18 @@ +// { dg-do assemble } +// prms-id: 418 + +class Base { +public: + int foo; +}; + +class Derived : public Base { +public: + int bar; +}; + +void func(Base&); // { dg-error "" } referenced by error below + +void func2(const Derived& d) { + func(d); // { dg-error "" } should be error because of const +}
p418.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net34.C =================================================================== --- net34.C (nonexistent) +++ net34.C (revision 816) @@ -0,0 +1,41 @@ +// { dg-do run } +// { dg-options "" } + +#include + +class foo { +public: + foo(int i) {k = i;} +protected: + int k; +}; + +class bar_1 : public foo { +public: + bar_1(int i) : foo(i) {} + int get_k() {return k;} +}; + +class bar_2 : public foo { +public: + bar_2(int i) : foo(i) {} + int get_k() {return k;} +}; + +class multiple : public bar_1, public bar_2 { +public: + multiple(int i1, int i2) : bar_1(i1), bar_2(i2) {} + void print() { + std::cout << "bar_1::k -> " << bar_1::k << "\n"; + std::cout << "bar_2::k -> " << bar_2::k << "\n"; + std::cout << "bar_1::get_k() -> " << bar_1::get_k() << "\n"; + std::cout << "bar_2::get_k() -> " << bar_2::get_k() << "\n"; + } +}; + +int main() { + multiple m(1,2); + m.print(); +} + +
net34.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net17.C =================================================================== --- net17.C (nonexistent) +++ net17.C (revision 816) @@ -0,0 +1,59 @@ +// { dg-do run } +// example from the ARM page 292 and 293 + +extern "C" int printf(const char *, ...); +extern "C" void exit(int); + +int i = 0; + +class A { +public: + A() { + printf("Doing A\n"); + if (++i != 1) + exit(1); + } +}; + +class B { +public: + B() { + printf("Doing B\n"); + if (++i != 2) + exit(1); + } +}; + +class C : public virtual A, public virtual B { +public: + C() { + printf("Doing C\n"); + if (++i != 3) + exit(1); + } +}; + +class D : public virtual B, public virtual A { +public: + D() { + printf("Doing D\n"); + if (++i != 4) + exit(1); + } +}; + +class E : public C, public D { +public: + E() { + printf("Doing E\n"); + if (++i != 5) + exit(1); + } +} e; + + +int main() { + if (++i != 6) + exit(1); + return 0; +}
net17.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh30.C =================================================================== --- eh30.C (nonexistent) +++ eh30.C (revision 816) @@ -0,0 +1,4 @@ +// { dg-do assemble { target native } } +// { dg-options "-fexceptions -fPIC -S" } + +main() { throw 1; }
eh30.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ambig1.C =================================================================== --- ambig1.C (nonexistent) +++ ambig1.C (revision 816) @@ -0,0 +1,33 @@ +// { dg-do assemble } +extern "C" int printf(const char *, ...); + +struct VB { + virtual void f() { + printf("VB\n"); + } +}; + +class M : public virtual VB { +public: + int i; + void f() { + printf("M(%d)\n", i); + } +}; + +class lM : public M { +}; + +class rM : public M { +}; + +class D : public lM, rM { // { dg-error "" } ambiguous function +} d; + +int main() { + ((lM*)&d)->i = 1; + ((rM*)&d)->i = 2; + ((rM*)&d)->f(); + ((lM*)&d)->f(); + ((VB*)&d)->f(); +}
ambig1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh13.C =================================================================== --- eh13.C (nonexistent) +++ eh13.C (revision 816) @@ -0,0 +1,6 @@ +// { dg-do run { xfail arm-*-pe } } +// { dg-options "-fexceptions" } + +#include + +main() { }
eh13.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p16146.C =================================================================== --- p16146.C (nonexistent) +++ p16146.C (revision 816) @@ -0,0 +1,90 @@ +// { dg-do run } +// prms-id: 16146 + +extern "C" int printf (const char *, ...); + +class myFoundation { +protected: + myFoundation () { count = 0; }; + virtual ~myFoundation () {}; + +public: + void addRef () { ++count; } + void removeRef () { if (count > 0) --count; } + +private: + long count; +}; + + +class firstIntermediate :virtual public myFoundation { +public: + firstIntermediate () {}; + ~firstIntermediate () {}; + + void bar () { printf ("Bar\n"); } +}; + + +class firstBase : public firstIntermediate { +public: + firstBase () {}; + ~firstBase () {}; + + virtual void g () {}; +}; + + +class secondIntermediate : virtual public myFoundation { +public: + secondIntermediate () {}; + ~secondIntermediate () {}; + + virtual void h () {}; +}; + + +class secondBase : public secondIntermediate { +public: + secondBase () {}; + ~secondBase () {}; + + virtual void h () {}; +}; + + +class typeInterface : virtual public firstBase { +public: + typeInterface () {}; + ~typeInterface () {}; + + virtual void i () {}; +}; + +class classServices : virtual public firstBase, + public secondBase { +public: + classServices () {}; + ~classServices () {}; + + virtual void j () {}; +}; + +class classImplementation : public typeInterface, + public classServices { +public: + classImplementation () {}; + ~classImplementation () {}; + + void g () {}; + void h () {}; + void i () {}; + void j () {}; +}; + +int main () { + firstBase* fbp = new classImplementation; + classImplementation* cip = dynamic_cast (fbp); + cip->addRef(); + myFoundation* mfp = cip; +}
p16146.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns1.C =================================================================== --- ns1.C (nonexistent) +++ ns1.C (revision 816) @@ -0,0 +1,12 @@ +// { dg-do run } +namespace Foo { + int bar() { + return 0; + } +} + +using namespace Foo; + +int main() { + bar(); +}
ns1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: fresco1.C =================================================================== --- fresco1.C (nonexistent) +++ fresco1.C (revision 816) @@ -0,0 +1,13 @@ +// { dg-do assemble } + +// This is a Fresco found bug. + +class WhoCares {}; + +typedef float Coord; + +class BugDemo : public WhoCares { +public: + typedef Coord Matrix[4][4]; + virtual void vf1(BugDemo::Matrix m) = 0; +};
fresco1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p783b.C =================================================================== --- p783b.C (nonexistent) +++ p783b.C (revision 816) @@ -0,0 +1,38 @@ +// { dg-do run } +// This one check for objects being destroyed twice. The bug it is +// looking for is the extra dtor call on C() even though it is never +// built. +// prms-id: 783 + +extern "C" int printf (const char *, ...); +extern "C" void exit (int); + +class C { + int i; +public: +// C() {printf ("C ctor at %x\n", this);} +// ~C() {printf ("C dtor at %x\n", this);} + C() { + i = 1; + } + ~C() { + if (i != 1) { + exit(1); + } + i = 0; + } +}; + +C g; + +C func() { + return g; +} + +int main(int argc, char**argv) { + C c,d; +// printf ("\n"); + c = (argc != 1) ? C() : d; +// printf ("\n"); + return 0; +}
p783b.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh55.C =================================================================== --- eh55.C (nonexistent) +++ eh55.C (revision 816) @@ -0,0 +1,19 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +#include +#include + +void my_terminate_handler() { + exit(0); +} + +void throw_an_unexpected_exception() throw() { + throw 1; +} + +int main() { + std::set_terminate(my_terminate_handler); + throw_an_unexpected_exception(); + return 1; +}
eh55.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh38.C =================================================================== --- eh38.C (nonexistent) +++ eh38.C (revision 816) @@ -0,0 +1,28 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +#include + +class B { +public: + int data; + B(int i) : data(i) { + } +} b(42); + +main() { + try { + throw &b; + } catch (const B* bptr) { + if (bptr->data == 42) + { + try { + throw &b; + } catch (void *bptr) { + if (((B*)bptr)->data == 42) + return 0; + } + } + } + return 1; +}
eh38.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p789a.C =================================================================== --- p789a.C (nonexistent) +++ p789a.C (revision 816) @@ -0,0 +1,44 @@ +// { dg-do run } +// global and local multidimensional array objects are not getting +// constructors called on any dimension, other than the first. Also, +// the destructors are not being called. Seems odd, they probably +// used to work. :-( +// prms-id: 789 + +extern "C" int printf (const char *, ...); +struct foo +{ + static int count; + void print (int i, int j) { printf ("foo[%d][%d] = %d\n", i, j, x); } + int x; + foo () { + x = count++; + printf("this %d = %x\n", x, (void *)this); + } + virtual ~foo () { + printf("this %d = %x\n", x, (void *)this); + --count; + } +}; +int foo::count; + + +int main () +{ + { + foo array[3][3]; + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + printf("&a[%d][%d] = %x\n", i, j, (void *)&array[i][j]); + } + } + // The count should be nine, if not, fail the test. + if (foo::count != 9) + return 1; + } + if (foo::count != 0) + return 1; + return 0; +}
p789a.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns9.C =================================================================== --- ns9.C (nonexistent) +++ ns9.C (revision 816) @@ -0,0 +1,12 @@ +// { dg-do run } +namespace Foo { + int bar() { + return 0; + } +} + +using Foo::bar; + +int main() { + return bar(); +}
ns9.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh4.C =================================================================== --- eh4.C (nonexistent) +++ eh4.C (revision 816) @@ -0,0 +1,6 @@ +// { dg-do assemble } +// { dg-options "-fexceptions" } + +void foo() { + throw 1; +}
eh4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3708a.C =================================================================== --- p3708a.C (nonexistent) +++ p3708a.C (revision 816) @@ -0,0 +1,87 @@ +// { dg-do run } +// prms-id: 3708 + +extern "C" int printf (const char *, ...); +extern "C" int atoi (const char *); + +void *ptr; + +class A { +public: + A() { printf ("A is constructed.\n"); } + virtual void xx(int doit) { printf ("A is destructed.\n"); } +}; + +class A1 { +public: + A1() { printf ("A1 is constructed.\n"); } + virtual void xx(int doit) { printf ("A1 is destructed.\n"); } +}; + +class B : public A1, public virtual A { +public: + B() { printf ("B is constructed.\n"); } + virtual void xx(int doit) { + printf ("B is destructed.\n"); + A1::xx (1); + if (doit) A::xx (1); + } +}; + +int num; + +class C : public virtual A, public B { +public: + C() { ++num; printf ("C is constructed.\n"); + ptr = this; + } + virtual void xx(int doit) { + --num; + if (ptr != this) + printf("FAIL\n%x != %x\n", ptr, this); + printf ("C is destructed.\n"); + B::xx (0); + if (doit) A::xx (1); + } +}; + +void fooA(A *a) { + printf ("Casting to A!\n"); + a->xx (1); +} +void fooA1(A1 *a) { + printf ("Casting to A1!\n"); + a->xx (1); +} + +void fooB(B *b) { + printf ("Casting to B!\n"); + b->xx (1); +} + +void fooC(C *c) { + printf ("Casting to C!\n"); + c->xx (1); +} + +int main(int argc, char *argv[]) { + printf ("*** Construct C object!\n"); + C *c = new C(); + + int i = 0; + + printf ("*** Try to delete the casting pointer!\n"); + switch (i) + { + case 0: fooA1(c); + break; + case 1: fooA(c); + break; + case 2: fooB(c); + break; + case 3: fooC(c); + break; + } + + return num!=0; +}
p3708a.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p2846.C =================================================================== --- p2846.C (nonexistent) +++ p2846.C (revision 816) @@ -0,0 +1,67 @@ +// { dg-do run } +// prms-id: 2846 + +extern "C" int printf(const char *, ...); +extern "C" void exit(int); + +class A; +class B; + +int c; + +class A { +public: + + A(void){} + A(const A&){} + A(const B&); + + virtual ~A(void){} + + virtual void print(void) const { + printf("A::print\n"); + printf("FAIL\n"); + exit(1); + } + B compute(void) const; +}; + +class B : private A { +friend class A; +public: + + virtual ~B(void){} + + void print(void) const { + ++c; + printf("B::print\n"); + } + +private: + B(const A& x, int){} +}; + +A::A(const B& s) { + s.print(); +} + +B A::compute(void) const { + B sub(*this, 1); + return sub; +} + +int main () +{ + A titi; + A toto = titi.compute(); + if (c != 1) + { + printf ("FAIL\n"); + return 1; + } + else + { + printf("PASS\n"); + return 0; + } +}
p2846.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mangle1.C =================================================================== --- mangle1.C (nonexistent) +++ mangle1.C (revision 816) @@ -0,0 +1,27 @@ +// { dg-do assemble } +// { dg-options "" } + +// Make sure the typedef name is used in name mangling, not some random +// anonymous name + +struct foo { + typedef enum { red } color; + void bar(color r) { + } +} f; + +#ifdef sparc +void f1() asm("bar__3fooQ23foo3$_0"); +void f1() { +} +void f2() asm("_bar__3fooQ23foo3$_0"); +void f2() { +} +void f3() asm("__bar__3fooQ23foo3$_0"); +void f3() { +} +#endif + +main() { + f.bar(foo::red); +}
mangle1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4736c.C =================================================================== --- p4736c.C (nonexistent) +++ p4736c.C (revision 816) @@ -0,0 +1,63 @@ +// { dg-do run } +// prms-id: 4736 + +int did_fail; + +class Rep { +public: + virtual ~Rep() { } +}; + +class Rep_1 : public Rep { +}; + +class VBaseMain { +public: + virtual ~VBaseMain() { } +}; + +class OtherVBase { +public: + virtual ~OtherVBase() { } +}; + +class Rep_2 : public Rep { +}; + +class DVBase : public VBaseMain, public Rep_2, public OtherVBase { +public: + virtual ~DVBase() { } +}; + +class Main : public Rep_1, virtual public DVBase { +public: + virtual ~Main() { did_fail = 0; } +}; + +int main() { + Main* m; + did_fail = 1; + delete new Main; + if (did_fail) + return 1; + did_fail = 1; + delete (Rep*)(Rep_1*)new Main; + if (did_fail) + return 2; + did_fail = 1; + delete (DVBase*)new Main; + if (did_fail) + return 3; + did_fail = 1; + delete (VBaseMain*)(DVBase*)new Main; + if (did_fail) + return 4; + did_fail = 1; + delete (Rep*)(Rep_2*)(DVBase*)new Main; + if (did_fail) + return 5; + did_fail = 1; + delete (OtherVBase*)(DVBase*)new Main; + if (did_fail) + return 6; +}
p4736c.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p6746.C =================================================================== --- p6746.C (nonexistent) +++ p6746.C (revision 816) @@ -0,0 +1,18 @@ +// { dg-do assemble } +// prms-id: 6746 + +class call_trace { +public: + call_trace(const char* fcn_name); + ~call_trace(); +}; + +static char * last_tree; +extern "C" void prt(); + +char * smt_mark_stree() { + const char* _my_name = "smt_mark_stree" ; + call_trace _t(_my_name); + + return last_tree = 0 ? (char*)0 : (prt(), (char*)0); +}
p6746.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p9732b.C =================================================================== --- p9732b.C (nonexistent) +++ p9732b.C (revision 816) @@ -0,0 +1,47 @@ +// { dg-do run } +// prms-id: 9732 + +int count; +int bail = 0; + +extern "C" void abort (void); +extern "C" void _exit (int); + + +struct base { + base () { ++count; } + ~base () { --count; } + base(const base&o) { ++count; } +}; + +class D { +public: + ~D() { + if (bail++) + { + // On some Linux boxes, we run the dtor for d twice, + // once before exit, and once after! + abort (); + } + else + { + if (count != 0) + _exit (1); + _exit (0); + } + } +} d; + +base base_object; + +base base_returning_function (); + +const base& base_ref = base_returning_function (); + +int main () { +} + +base base_returning_function () { + base local_base_object; + return local_base_object; +}
p9732b.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dyncast3.C =================================================================== --- dyncast3.C (nonexistent) +++ dyncast3.C (revision 816) @@ -0,0 +1,19 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe**-* } } +// { dg-options "-fexceptions -w" } +// Ensure that the return type of dynamic_cast is the real type. + +struct B { + virtual int f() { } +}; + +struct D : public B { + virtual int f() { } + int i; +} od; + +main() { + B *b=&od; + if (dynamic_cast(b)->i) + return 1; + return 0; +}
dyncast3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net43.C =================================================================== --- net43.C (nonexistent) +++ net43.C (revision 816) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// { dg-options "-ffriend-injection" } + +class foo { + public: + friend int operator ^(const foo&, const foo&); +}; + +int main () +{ + int (*funptr) (const foo &, const foo &) = operator ^; +}
net43.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: warn6.C =================================================================== --- warn6.C (nonexistent) +++ warn6.C (revision 816) @@ -0,0 +1,42 @@ +// { dg-do assemble } +// { dg-options "-Woverloaded-virtual" } + +struct B4 { + virtual void bothfardiff(float); // { dg-warning "" } was hidden +}; + +struct B3 : public B4 { +}; + +struct B2 { +}; + +struct B { + virtual void baseonly(int); + + virtual void bothsame(int); + + virtual void bothdiff(float); // { dg-warning "" } was hidden + + virtual void both2same(int); + virtual void both2same(float); + + virtual void both12diff(int); + virtual void both12diff(float); // { dg-warning "" } was hidden +}; + +struct D : public B, public B2, public B3 { + virtual void derivedonly(int); + + virtual void bothsame(int); + + virtual void bothdiff(int); // { dg-warning "" } + + virtual void both2same(int); + virtual void both2same(float); + + virtual void both12diff(int); // { dg-warning "" } + + virtual void bothfardiff(int); // { dg-warning "" } +}; +
warn6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net26.C =================================================================== --- net26.C (nonexistent) +++ net26.C (revision 816) @@ -0,0 +1,28 @@ +// { dg-do run } +// A test case found by InterViews testing... + +extern "C" int printf(const char *, ...); + +class A { +public: + int foo() { printf("ok nv\n"); return 0; } + virtual int vfoo() { printf("ok v\n"); return 0; } +}; + +struct S { + int (A::*pfn1)(); + int (A::*pfn2)(); + int (A::*pfn3)(); +}; + +// This failed before. +S s = { &A::foo, &A::vfoo, &A::foo }; + +A a; + +int main() { + (a.*s.pfn1)(); + (a.*s.pfn2)(); + printf("PASS\n"); + return 0; +}
net26.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: rtti1.C =================================================================== --- rtti1.C (nonexistent) +++ rtti1.C (revision 816) @@ -0,0 +1,4 @@ +// { dg-do assemble } + +#include +#include
rtti1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: temp.C =================================================================== --- temp.C (nonexistent) +++ temp.C (revision 816) @@ -0,0 +1,32 @@ +// { dg-do run } +extern "C" int printf(const char *, ...); +extern "C" const char *getenv(const char *); + +class T { + int i; +public: + T() { + i = 1; + printf("T() at %x\n", this); + } + T(const T& o) { + i = o.i; + printf("T(const T&) at %x <-- %x\n", this, &o); + } + T operator +(const T& o) { + T r; + r.i = this->i + o.i; + return r; + } + operator int () { + return i; + } + ~T() { printf("~T() at %x\n", this); } +} s, b; + +int foo() { return getenv("TEST") == 0; } + +int main() { + int i = foo() ? s+b : s; + return i != 2; +}
temp.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: offset1.C =================================================================== --- offset1.C (nonexistent) +++ offset1.C (revision 816) @@ -0,0 +1,39 @@ +// { dg-do run } +extern "C" int printf(const char *, ...); +void *vp; +int fail = 0; + +class Foo { +public: + virtual void setName() { + printf("Foo at %x\n", this); + if (vp != (void*)this) + fail = 1; + } +}; + +class Bar : public Foo { +public: + virtual void init(int argc, char **argv) { + printf("Bar's Foo at %x\n", (Foo*)this); + vp = (void*)(Foo*)this; + setName(); + } +}; + +class Barf : virtual public Bar { +public: + virtual void init(int argc, char **argv) { Bar::init(argc, argv); } +}; + +class Baz : virtual public Bar, virtual public Barf { +public: + virtual void init(int argc, char **argv) { Barf::init(argc, argv); } +}; + +Bar *theBar = new Baz(); + +int main(int argc, char **argv) { + theBar->init(argc, argv); + return fail; +}
offset1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh47.C =================================================================== --- eh47.C (nonexistent) +++ eh47.C (revision 816) @@ -0,0 +1,23 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +#include +#include + +void myterm() { + exit (0); +} + +main() { + try { + throw ""; + } catch (...) { + } + try { + std::set_terminate (myterm); + throw; + } catch (...) { + return 1; + } + return 1; +}
eh47.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pt4.C =================================================================== --- pt4.C (nonexistent) +++ pt4.C (revision 816) @@ -0,0 +1,4 @@ +// { dg-do assemble } + +template struct B { B() { } }; +B<0> bnull; // { dg-error "" } could not convert template argument
pt4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: virt4.C =================================================================== --- virt4.C (nonexistent) +++ virt4.C (revision 816) @@ -0,0 +1,28 @@ +// { dg-do run } +// { dg-options "" } + +void Foo () {} + +class B { +public: + virtual void foo() = 0; +}; + +class D: virtual public B { +public: + void foo() { Foo(); } +}; + +class D1: public D {}; + +class D2: public D {}; + +class D1_2: public D1, public D2 { +public: + void foo() { D1::foo(); D2::foo(); } +}; + +main() { + D1_2 h; + h.foo(); +}
virt4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3060c.C =================================================================== --- p3060c.C (nonexistent) +++ p3060c.C (revision 816) @@ -0,0 +1,23 @@ +// { dg-do assemble } +// A new problem with my pointer to member function work. +// prms-id: 3060 + +class Foo +{ + public: + int x; + int y; + Foo (int i, int j) { x = i; y = j; } + operator int (); +}; + +int Foo::operator int() { return x; } // { dg-warning "" } can't specify return type + +Foo foo(10, 11); + +int +main() +{ + int Foo::* pmi = &Foo::y; + return foo.*pmi; +}
p3060c.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4173.C =================================================================== --- p4173.C (nonexistent) +++ p4173.C (revision 816) @@ -0,0 +1,26 @@ +// { dg-do assemble } +// { dg-options "-Wall -ansi -pedantic-errors" } +// This error happens because lvalue is not done well in the C++ front-end. +// NOPs should be lvalues if their arguments are. +// NON_LVALUE_EXPRs shouldn't be. + +// prms-id: 4173 + +enum TypeKind { + RecordTypeKind +}; +struct Type +{ + enum TypeKind kind : 8; + unsigned char prefixLen; +}; + +Type a; +Type b; +TypeKind c; + +int +main() { + a.kind = b.kind = c; + (a.kind = c) = b.kind; // { dg-bogus "" } +}
p4173.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4671.C =================================================================== --- p4671.C (nonexistent) +++ p4671.C (revision 816) @@ -0,0 +1,16 @@ +// { dg-do assemble } +// prms-id: 4671 + +class ccUnwind { +public: + virtual void _c_getInfo() const; + virtual ~ccUnwind (); +}; +class ccTransmittable { +public: + virtual ~ccTransmittable(); +}; +class ccCommand : public ccUnwind, public ccTransmittable { +}; +class foo : public ccCommand { +};
p4671.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p8154.C =================================================================== --- p8154.C (nonexistent) +++ p8154.C (revision 816) @@ -0,0 +1,19 @@ +// { dg-do assemble } +// { dg-options "-w -fpermissive" } +// prms-id: 8154 + +class QvFieldData; +class QvNode { + QvFieldData *fieldData; +}; +class QvGroup : public QvNode { + static QvFieldData *fieldData; +}; +class QvUnknownNode : public QvGroup +{ +public: + QvUnknownNode :: QvUnknownNode (); +private: + static QvFieldData *fieldData; + virtual QvFieldData *getFieldData() { return fieldData; } +};
p8154.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: misc7.C =================================================================== --- misc7.C (nonexistent) +++ misc7.C (revision 816) @@ -0,0 +1,16 @@ +// { dg-do assemble } +// GROUPS passed MI +struct S1 { }; + +struct S2 : S1 { }; +struct S3 : S1 { }; + +struct S4 : S3, S2 { }; + +struct S1 *p1; +struct S4 *p4; + +void foobar () +{ + p1 = p4; // { dg-error "" } this is illegal// ERROR - .* +}
misc7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p2855.C =================================================================== --- p2855.C (nonexistent) +++ p2855.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// { dg-options "-Wcast-qual" } +// prms-id: 2855 + +class Ctest { +private: + char* data; +public: + operator const char *() const; +}; + +Ctest::operator const char *() const +{ + return data; +} +int main() +{ + Ctest obj; + char* temp = (char *)obj; // { dg-warning "" } + temp[0] = '\0'; +}
p2855.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p11110.C =================================================================== --- p11110.C (nonexistent) +++ p11110.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// prms-id: 11110 + +class data; + +class conatiner { +public: + virtual void* first (); + virtual data* contents (void* i); // { dg-error "" } candidates +}; + +class user { +public: + data* data1 () const; +private: + conatiner& _c; +}; + +data* user::data1() const { + return (_c.contents (_c.first)); // { dg-error "" } +}
p11110.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p8039.C =================================================================== --- p8039.C (nonexistent) +++ p8039.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// prms-id: 8039 + +class C { +public: + int func (); +}; + +extern void bar(int*); + +int main() +{ + int (C::*mfp)() = &C::func; + bar((int*)mfp); // { dg-error "" } no clear semantics +}
p8039.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p11012.C =================================================================== --- p11012.C (nonexistent) +++ p11012.C (revision 816) @@ -0,0 +1,14 @@ +// { dg-do assemble } +// { dg-options "-Wno-pmf-conversions" } +// prms-id: 11012 + +class Foo { +public: + int f(){ return 0; } +}; + +void foo() { + void *p1 = &Foo::f; + const void *p2 = &Foo::f; + int (*p3)() = &Foo::f; +}
p11012.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: init1.C =================================================================== --- init1.C (nonexistent) +++ init1.C (revision 816) @@ -0,0 +1,26 @@ +// { dg-do run } +int count; + +extern "C" void _exit(int); + +struct C { + ~C() { if (count != 1) _exit(1); } +} c; + +class A { +public: + ~A () { ++count; } +}; + +void f() { + static A a; +} + +void g() { + // Since this isn't constructed, we can't destruct it. + static A a; +} + +int main () { + f(); +}
init1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net10.C =================================================================== --- net10.C (nonexistent) +++ net10.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// { dg-options "-pedantic-errors" } + +const int ci=10, *pc = &ci, *const cpc = pc, **ppc; +int i, *p, *const cp = &i; + +int main() +{ + i = ci; + *cp = ci; + pc++; + pc = cpc; + pc = p; + ppc = &pc; +}
net10.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p811.C =================================================================== --- p811.C (nonexistent) +++ p811.C (revision 816) @@ -0,0 +1,549 @@ +// { dg-do assemble } +// { dg-options "" } +// This test case caused the compiler to abort at one point in time. +// prms-id: 811 + +class ostream; class streambuf; + +typedef long streamoff, streampos; + +struct _ios_fields { + streambuf *_strbuf; + ostream* _tie; + int _width; + unsigned long _flags; + char _fill; + unsigned char _state; + unsigned short _precision; +}; + + +enum state_value { _good = 0, _eof = 1, _fail = 2, _bad = 4 }; +enum open_mode { input=1, output=2, append=8 }; + + +class ios : public _ios_fields { + public: + enum io_state { goodbit=0, eofbit=1, failbit=2, badbit=4 }; + enum open_mode { + in=1, + out=2, + ate=4, + app=8, + trunc=16, + nocreate=32, + noreplace=64 }; + enum seek_dir { beg, cur, end}; + enum { skipws=01, left=02, right=04, internal=010, + dec=020, oct=040, hex=0100, + showbase=0200, showpoint=0400, uppercase=01000, showpos=02000, + scientific=04000, fixed=0100000, unitbuf=020000, stdio=040000, + dont_close=0x80000000 + }; + + ostream* tie() const { return _tie; } + ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; } + + + char fill() const { return _fill; } + char fill(char newf) { char oldf = _fill; _fill = newf; return oldf; } + unsigned long flags() const { return _flags; } + unsigned long flags(unsigned long new_val) { + unsigned long old_val = _flags; _flags = new_val; return old_val; } + unsigned short precision() const { return _precision; } + unsigned short precision(int newp) { + unsigned short oldp = _precision; _precision = (unsigned short)newp; + return oldp; } + unsigned long setf(unsigned long val) { + unsigned long oldbits = _flags; + _flags |= val; return oldbits; } + unsigned long setf(unsigned long val, unsigned long mask) { + unsigned long oldbits = _flags; + _flags = (_flags & ~mask) | (val & mask); return oldbits; } + unsigned long unsetf(unsigned long mask) { + unsigned long oldbits = _flags & mask; + _flags &= ~mask; return oldbits; } + int width() const { return _width; } + int width(long val) { long save = _width; _width = val; return save; } + + static const unsigned long basefield; + static const unsigned long adjustfield; + static const unsigned long floatfield; + + streambuf* rdbuf() const { return _strbuf; } + void clear(int state = 0) { _state = state; } + int good() const { return _state == 0; } + int eof() const { return _state & ios::eofbit; } + int fail() const { return _state & (ios::badbit|ios::failbit); } + int bad() const { return _state & ios::badbit; } + int rdstate() const { return _state; } + void set(int flag) { _state |= flag; } + operator void*() const { return fail() ? (void*)0 : (void*)this; } + int operator!() const { return fail(); } + + + void unset(state_value flag) { _state &= ~flag; } + void close(); + int is_open(); + int readable(); + int writable(); + + + protected: + ios(streambuf*sb) { _strbuf=sb; _state=0; _width=0; _fill=' '; + _flags=ios::skipws; _precision=6; } +}; + + + + +typedef ios::seek_dir _seek_dir; + + + + + + + + + + + + + + + + + + + + + + +//# 168 "/usr/latest/lib/g++-include/streambuf.h" 3 + + +struct __streambuf { + + int _flags; + char* _gptr; + char* _egptr; + char* _eback; + char* _pbase; + char* _pptr; + char* _epptr; + char* _base; + char* _ebuf; + struct streambuf *_chain; + + + + +}; + +struct streambuf : private __streambuf { + friend class ios; + friend class istream; + friend class ostream; + protected: + static streambuf* _list_all; + streambuf*& xchain() { return _chain; } + void _un_link(); + void _link_in(); + char* gptr() const { return _gptr; } + char* pptr() const { return _pptr; } + char* egptr() const { return _egptr; } + char* epptr() const { return _epptr; } + char* pbase() const { return _pbase; } + char* eback() const { return _eback; } + char* ebuf() const { return _ebuf; } + char* base() const { return _base; } + void xput_char(char c) { *_pptr++ = c; } + int xflags() { return _flags; } + int xflags(int f) { int fl = _flags; _flags = f; return fl; } + void xsetflags(int f) { _flags |= f; } + void gbump(int n) { _gptr += n; } + void pbump(int n) { _pptr += n; } + void setb(char* b, char* eb, int a=0); + void setp(char* p, char* ep) { _pbase=_pptr=p; _epptr=ep; } + void setg(char* eb, char* g, char *eg) { _eback=eb; _gptr=g; _egptr=eg; } + public: + static int flush_all(); + static void flush_all_linebuffered(); + virtual int underflow(); + virtual int overflow(int c = (-1) ); + virtual int doallocate(); + virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); + virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out); + int sputbackc(char c); + int sungetc(); + streambuf(); + virtual ~streambuf(); + int unbuffered() { return _flags & 2 ? 1 : 0; } + int linebuffered() { return _flags & 0x4000 ? 1 : 0; } + void unbuffered(int i) + { if (i) _flags |= 2 ; else _flags &= ~2 ; } + void linebuffered(int i) + { if (i) _flags |= 0x4000 ; else _flags &= ~0x4000 ; } + int allocate() { + if (base() || unbuffered()) return 0; + else return doallocate(); } + virtual int sync(); + virtual int pbackfail(int c); + virtual int ungetfail(); + virtual streambuf* setbuf(char* p, int len); + int in_avail() { return _egptr - _gptr; } + int out_waiting() { return _pptr - _pbase; } + virtual int sputn(const char* s, int n); + virtual int sgetn(char* s, int n); + long sgetline(char* buf, int n, char delim, int putback_delim); + int sbumpc() { + if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ; + else return *(unsigned char*)_gptr++; } + int sgetc() { + if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ; + else return *(unsigned char*)_gptr; } + int snextc() { + if (++_gptr >= _egptr && underflow() == (-1) ) return (-1) ; + else return *(unsigned char*)_gptr; } + int sputc(int c) { + if (_pptr >= _epptr) return overflow(c); + return *_pptr++ = c, (unsigned char)c; } + int vscan(char const *fmt0, char* ap); + int vform(char const *fmt0, char* ap); + + + + + + +}; + +struct __file_fields { + char _fake; + char _shortbuf[1]; + short _fileno; + int _blksize; + char* _save_gptr; + char* _save_egptr; + long _offset; +}; + +class filebuf : public streambuf { + struct __file_fields _fb; + void init(); + public: + filebuf(); + filebuf(int fd); + filebuf(int fd, char* p, int len); + ~filebuf(); + filebuf* attach(int fd); + filebuf* open(const char *filename, const char *mode); + filebuf* open(const char *filename, int mode, int prot = 0664); + virtual int underflow(); + virtual int overflow(int c = (-1) ); + int is_open() { return _fb._fileno >= 0; } + int fd() { return is_open() ? _fb._fileno : (-1) ; } + filebuf* close(); + virtual int doallocate(); + virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); + int sputn(const char* s, int n); + int sgetn(char* s, int n); + virtual int sync(); + protected: + virtual int pbackfail(int c); + int is_reading() { return eback() != egptr(); } + char* cur_ptr() { return is_reading() ? gptr() : pptr(); } + + char* file_ptr() { return _fb._save_gptr ? _fb._save_egptr : egptr(); } + int do_flush(); + + virtual int sys_read(char* buf, int size); + virtual long sys_seek(long , _seek_dir); + virtual long sys_write(const void*, long); + virtual int sys_stat(void*); + virtual int sys_close(); +}; + + +inline int ios::readable() { return rdbuf()->_flags & 4 ; } +inline int ios::writable() { return rdbuf()->_flags & 8 ; } +inline int ios::is_open() {return rdbuf()->_flags & 4 +8 ;} + + + + +//# 25 "/usr/latest/lib/g++-include/iostream.h" 2 3 + + +class istream; class ostream; +typedef istream& (*__imanip)(istream&); +typedef ostream& (*__omanip)(ostream&); + +extern istream& ws(istream& ins); +extern ostream& flush(ostream& outs); +extern ostream& endl(ostream& outs); +extern ostream& ends(ostream& outs); + +class ostream : public ios +{ + void do_osfx(); + public: + ostream(); + ostream(streambuf* sb, ostream* tied=__null ); + ~ostream(); + + int opfx() { if (!good()) return 0; if (_tie) _tie->flush(); return 1; } + void osfx() { if (flags() & (ios::unitbuf|ios::stdio)) + do_osfx(); } + streambuf* ostreambuf() const { return _strbuf; } + ostream& flush(); + ostream& put(char c); + ostream& write(const char *s, int n); + ostream& write(const unsigned char *s, int n) { return write((char*)s, n);} + ostream& write(const void *s, int n) { return write((char*)s, n);} + ostream& seekp(streampos); + ostream& seekp(streamoff, _seek_dir); + streampos tellp(); + ostream& form(const char *format ...); + ostream& vform(const char *format, char* args); +}; + +extern ostream& operator<<(ostream&, char c); +inline ostream& operator<<(ostream& os, unsigned char c) +{ return os << (char)c; } + +extern ostream& operator<<(ostream&, const char *s); +inline ostream& operator<<(ostream& os, const unsigned char *s) +{ return os << (const char*)s; } + + +extern ostream& operator<<(ostream&, void *p); +extern ostream& operator<<(ostream&, int n); +extern ostream& operator<<(ostream&, long n); +extern ostream& operator<<(ostream&, unsigned int n); +extern ostream& operator<<(ostream&, unsigned long n); +inline ostream& operator<<(ostream& os, short n) {return os << (int)n;} +inline ostream& operator<<(ostream& os, unsigned short n) +{return os << (unsigned int)n;} +extern ostream& operator<<(ostream&, float n); +extern ostream& operator<<(ostream&, double n); +inline ostream& operator<<(ostream& os, __omanip func) { return (*func)(os); } +extern ostream& operator<<(ostream&, streambuf*); + +class istream : public ios +{ + int _gcount; + public: + istream(); + istream(streambuf* sb, ostream*tied=__null ); + ~istream(); + streambuf* istreambuf() const { return _strbuf; } + istream& get(char& c); + istream& get(unsigned char& c); + istream& read(char *ptr, int n); + istream& read(unsigned char *ptr, int n) { return read((char*)ptr, n); } + istream& read(void *ptr, int n) { return read((char*)ptr, n); } + + istream& getline(char* ptr, int len, char delim = '\n'); + istream& get(char* ptr, int len, char delim = '\n'); + istream& gets(char **s, char delim = '\n'); + int ipfx(int need) { + if (!good()) { set(ios::failbit); return 0; } + if (_tie && (need == 0 || rdbuf()->in_avail() < need)) _tie->flush(); + if (!need && (flags() & ios::skipws) && !ws(*this)) return 0; + return 1; + } + int ipfx0() { + if (!good()) { set(ios::failbit); return 0; } + if (_tie) _tie->flush(); + if ((flags() & ios::skipws) && !ws(*this)) return 0; + return 1; + } + int ipfx1() { + if (!good()) { set(ios::failbit); return 0; } + if (_tie && rdbuf()->in_avail() == 0) _tie->flush(); + return 1; + } + int get() { if (!ipfx1()) return (-1) ; + int ch = _strbuf->sbumpc(); + if (ch == (-1) ) set(ios::eofbit); + return ch; } + int peek() { if (!ipfx1()) return (-1) ; + int ch = _strbuf->sgetc(); + if (ch == (-1) ) set(ios::eofbit); + return ch; } + int gcount() { return _gcount; } + istream& ignore(int n=1, int delim = (-1) ); + istream& seekg(streampos); + istream& seekg(streamoff, _seek_dir); + streampos tellg(); + istream& putback(char ch) { + if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit); + return *this;} + istream& unget() { + if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit); + return *this;} + + istream& unget(char ch) { return putback(ch); } + int skip(int i); + +}; + +extern istream& operator>>(istream&, char*); +inline istream& operator>>(istream& is, unsigned char* p) +{ return is >> (char*)p; } + +extern istream& operator>>(istream&, char& c); +extern istream& operator>>(istream&, unsigned char& c); + +extern istream& operator>>(istream&, int&); +extern istream& operator>>(istream&, long&); +extern istream& operator>>(istream&, short&); +extern istream& operator>>(istream&, unsigned int&); +extern istream& operator>>(istream&, unsigned long&); +extern istream& operator>>(istream&, unsigned short&); +extern istream& operator>>(istream&, float&); +extern istream& operator>>(istream&, double&); +inline istream& operator>>(istream& is, __imanip func) { return (*func)(is); } + +inline ostream& ostream::put(char c) { _strbuf->sputc(c); return *this; } + +class iostream : public ios { + int _gcount; + public: + iostream(); + iostream(streambuf* sb, ostream*tied=__null ); + operator istream&() { return *(istream*)this; } + operator ostream&() { return *(ostream*)this; } + ~iostream(); + + istream& get(char& c) { return ((istream*)this)->get(c); } + istream& get(unsigned char& c) { return ((istream*)this)->get(c); } + istream& read(char *ptr, int n) { return ((istream*)this)->read(ptr, n); } + istream& read(unsigned char *ptr, int n) + { return ((istream*)this)->read((char*)ptr, n); } + istream& read(void *ptr, int n) + { return ((istream*)this)->read((char*)ptr, n); } + istream& getline(char* ptr, int len, char delim = '\n') + { return ((istream*)this)->getline(ptr, len, delim); } + istream& get(char* ptr, int len, char delim = '\n') + { return ((istream*)this)->get(ptr, len, delim); } + istream& gets(char **s, char delim = '\n') + { return ((istream*)this)->gets(s, delim); } + istream& ignore(int n=1, int delim = (-1) ) + { return ((istream*)this)->ignore(n, delim); } + int ipfx(int need) { return ((istream*)this)->ipfx(need); } + int ipfx0() { return ((istream*)this)->ipfx0(); } + int ipfx1() { return ((istream*)this)->ipfx1(); } + int get() { return _strbuf->sbumpc(); } + int peek() { return ipfx1() ? _strbuf->sgetc() : (-1) ; } + int gcount() { return _gcount; } + istream& putback(char ch) { return ((istream*)this)->putback(ch); } + istream& unget() { return ((istream*)this)->unget(); } + istream& seekg(streampos pos) { return ((istream*)this)->seekg(pos); } + istream& seekg(streamoff off, _seek_dir dir) + { return ((istream*)this)->seekg(off, dir); } + streampos tellg() { return ((istream*)this)->tellg(); } + + istream& unget(char ch) { return putback(ch); } + + + + int opfx() { return ((ostream*)this)->opfx(); } + void osfx() { ((ostream*)this)->osfx(); } + ostream& flush() { return ((ostream*)this)->flush(); } + ostream& put(char c) { return ((ostream*)this)->put(c); } + ostream& write(const char *s, int n) + { return ((ostream*)this)->write(s, n); } + ostream& write(const unsigned char *s, int n) + { return ((ostream*)this)->write((char*)s, n); } + ostream& write(const void *s, int n) + { return ((ostream*)this)->write((char*)s, n); } + ostream& form(const char *format ...); + ostream& vform(const char *format, char* args) + { return ((ostream*)this)->vform(format, args); } + ostream& seekp(streampos pos) { return ((ostream*)this)->seekp(pos); } + ostream& seekp(streamoff off, _seek_dir dir) + { return ((ostream*)this)->seekp(off, dir); } + streampos tellp() { return ((ostream*)this)->tellp(); } +}; + +extern istream cin; +extern ostream cout, cerr, clog; + +struct Iostream_init { } ; + +inline ios& dec(ios& i) +{ i.setf(ios::dec, ios::dec|ios::hex|ios::oct); return i; } +inline ios& hex(ios& i) +{ i.setf(ios::hex, ios::dec|ios::hex|ios::oct); return i; } +inline ios& oct(ios& i) +{ i.setf(ios::oct, ios::dec|ios::hex|ios::oct); return i; } + + +//# 7 "/usr/latest/lib/g++-include/stream.h" 2 3 + + +extern char* form(const char*, ...); + +extern char* dec(long, int=0); +extern char* dec(int, int=0); +extern char* dec(unsigned long, int=0); +extern char* dec(unsigned int, int=0); + +extern char* hex(long, int=0); +extern char* hex(int, int=0); +extern char* hex(unsigned long, int=0); +extern char* hex(unsigned int, int=0); + +extern char* oct(long, int=0); +extern char* oct(int, int=0); +extern char* oct(unsigned long, int=0); +extern char* oct(unsigned int, int=0); + +inline istream& WS(istream& str) { return ws(str); } + + +//# 9 "test.C" 2 + + +class Y { +public: + Y() {} + virtual const char *stringify() = 0; + virtual char *stringify2() const = 0; // { dg-error "overriding" } +}; + +class X: public Y { +public: + X(): Y() {} + const char *stringify(); // { dg-error "candidate" } + const char *stringify2() const; // { dg-error "candidate|conflicting return type" } +}; + +char * +X::stringify() const // { dg-error "does not match" } +{ + return "stringify"; // { dg-warning "deprecated" } +} + +const char * +X::stringify2() // { dg-error "does not match" } +{ + return "stringify2"; +} + +main() +{ + X x; + Y& y = x; + + cout << "x\n"; + cout << x.stringify() << '\n'; + cout << x.stringify2() << '\n'; + + cout << "y\n"; + cout << y.stringify() << '\n'; + cout << y.stringify2() << '\n'; +}
p811.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p1989.C =================================================================== --- p1989.C (nonexistent) +++ p1989.C (revision 816) @@ -0,0 +1,494 @@ +// { dg-do assemble } +// prms-id: 1989 + +#define TRUE true +#define FALSE false +typedef void *Pix; + +template +struct link { + T item; + link *next; + link *prev; + + link(const T& t): item(t), prev(0), next(0) + { }; + link(const T& t, link *p, link *n): item(t), prev(p), next(n) + { }; +}; + +template +class List_DL { +public: + List_DL(); + List_DL(const List_DL&); + ~List_DL(); + + void append(const T& item); + void prepend(const T& item); + void insert(const T& item, Pix x, bool before); + + void remove(Pix& x) + { T tmp; remove(x, tmp); } + void remove(Pix& x, T& item); + + void clear(); + + unsigned length() const + { return count; } + +private: + + unsigned count; + link *head; + link *tail; + +public: + Pix first() const + { return Pix(head); } + Pix last() const + { return Pix(tail); } + void next(Pix& x) const + { if (0 != x) x = ((link *) x)->next; } + void prev(Pix& x) const + { if (0 != x) x = ((link *) x)->prev; } + T& operator()(Pix x) const + { return ((link *) x)->item; } +}; + +template +List_DL::List_DL(): +count(0), +head(0) +{ } + +template +List_DL::List_DL(const List_DL& other): +count(0), +head(0) +{ + for (Pix x=other.first(); 0 != x; other.next(x)) + append(other(x)); +} + +template +List_DL::~List_DL() +{ + clear(); +} + +template +void +List_DL::append(const T& item) +{ + count++; + if (0 == head) { + head = new link(item); + tail = head; + } else { + tail->next = new link(item, tail, 0); + tail = tail->next; + } +} + +template +void +List_DL::prepend(const T& item) +{ + count++; + if (0 == head) { + head = new link(item); + tail = head; + } else { + head = new link(item, 0, head); + if (tail == head) + tail = tail->next; + } +} + +template +void +List_DL::insert(const T& item, Pix x, bool before = TRUE) +{ + link *l = (link *) x; + + if (before) { + if (0 == l || l == head) { + prepend(item); + } else { + link *n = new link(item, l->prev, l); + l->prev->next = n; + l->prev = n; + } + } else { + if (0 == l || l == tail) { + append(item); + } else { + link *n = new link(item, l, l->next); + l->next->prev = n; + l->prev = n; + } + } +} + +template +void +List_DL::remove(Pix& x, T& item) +{ + link *l = (link *) x; + + if (0 == l) + return; + + item = l->item; + if (1 == count) { + delete head; + head = 0; + tail = 0; + } else { + // more than one item in the list + if (l == head) { + link *old = head; + head = head->next; + head->prev = 0; + delete old; + } else if (l == tail) { + link *old = tail; + tail = tail->prev; + tail->next = 0; + delete old; + } else { + l->next->prev = l->prev; + l->prev->next = l->next; + delete l; + } + } +} + +template +void +List_DL::clear() +{ + link *l, *succ; + for (l=head; 0 != l; l=succ) { + succ = l->next; + delete l; + } + head = 0; + tail = 0; +} + +template +class List_DLS: public List_DL { +public: + List_DLS(): List_DL() + { }; + List_DLS(const List_DLS& other): List_DL(other) + { }; + + bool contains(const T& item) const + { return search(item) != 0 ? TRUE: FALSE; } + Pix search(const T&) const; +}; + +template +Pix +List_DLS::search(const T& item) const +{ + for (Pix x=this->first(); 0 != x; this->next(x)) { + if (item == this->operator()(x)) // { dg-error "" } const subversion + return x; + } + return 0; +} + +template +class List_DLSp: public List_DL { +public: + List_DLSp(): List_DL() + { }; + List_DLSp(const List_DLSp& other): List_DL(other) + { }; + + bool contains(const T& item) const +#ifndef INTERNAL_ERROR + ; +#else + { return search(item) != 0 ? TRUE: FALSE; } +#endif + Pix search(const T&) const; +}; + +template +bool +List_DLSp::contains(const T& item) const +{ + for (Pix x=this->first(); 0 != x; this->next(x)) { + if (*item == *(this->operator()(x))) + return TRUE; + } + return FALSE; +} + +template +class Set { +public: + Set(); + Set(const Set& other); + + virtual void add(const T& item); + + void remove(const T& item) + { Pix x = search(item); remove(x); } + void remove(Pix& x) + { T tmp; remove(x, tmp); } + virtual void remove(Pix& x, T& item); + + virtual void clear(); + + virtual bool contains(const T&) const; + virtual Pix search(const T&) const; + + virtual unsigned length() const; + + virtual Pix first() const; + virtual void next(Pix& x) const; + virtual T& operator()(Pix x) const; +}; + +template +Set::Set() +{ } + +template +Set::Set(const Set& other) +{ } + + +template +class Set_DL: public List_DLS { +public: + Set_DL(); + Set_DL(const Set_DL& other); + + void add(const T& item) + { list.append(item); } + void remove(Pix& x, T& item) + { list.remove(x, item); } + + void clear() + { list.clear(); } + + bool contains(const T& item) const + { return list.contains(item); } + Pix search(const T& item) const + { return list.search(item); } + + unsigned length() const + { return list.length(); } + + Pix first() const + { return list.first(); } + void next(Pix& x) const + { list.next(x); } + T& operator()(Pix x) const + { return list(x); } +private: + List_DLS list; +}; + +template +class Set_DLp: public List_DLSp { +public: + Set_DLp(); + Set_DLp(const Set_DLp& other); + + void add(const T& item) + { list.append(item); } + void remove(Pix& x, T& item) + { list.remove(x, item); } + + void clear() + { list.clear(); } + + bool contains(const T& item) const + { return list.contains(item); } + Pix search(const T& item) const + { return list.search(item); } + + unsigned length() const + { return list.length(); } + + Pix first() const + { return list.first(); } + void next(Pix& x) const + { list.next(x); } + T& operator()(Pix x) const + { return list(x); } +private: + List_DLSp list; +}; + +template +struct vertex { + T item; + List_DL *> fanout; + + vertex(): item(), fanout() // { dg-bogus "" } + { }; + vertex(const T& i): item(), fanout() // { dg-bogus "" } + { }; +}; + +template +class Graph { +public: + Graph(); + Graph(const Graph&); + ~Graph(); + + void add(const T& from, const T& to); + bool contains(const T& from, const T& to) const; + + void clear() + { vertices.clear(); } + + unsigned lengthV() const + { return vertices.length(); } + + Pix firstV() const + { return vertices.first(); } + void nextV(Pix& x) const + { vertices.next(x); } + T& V(Pix x) const + { return vertices(x).item; } + + Pix firstV1(Pix vx) const; + void nextV1(Pix vx, Pix& x) const; + T& V1(Pix vx, Pix x) const; +private: + vertex *lookup(const T& from) const; + vertex *lookup_new(const T& from); + + List_DLS > vertices; +}; + +template +Graph::Graph(): +vertices() +{ } + +template +Graph::Graph(const Graph& other): +vertices() +{ + for (Pix vx=firstV(); 0 != vx; nextV(vx)) { + for (Pix vx1=firstV1(vx); 0 != vx1; nextV1(vx, vx1)) { + add(V(vx), V1(vx, vx1)); + } + } +} + +template +Graph::~Graph() +{ + clear(); +} + +template +void +Graph::add(const T& from, const T& to) +{ + vertex *fromv = lookup_new(from); + if (from == to) + return; + vertex *tov = lookup_new(to); + fromv->fanout.append(tov); +} + +template +bool +Graph::contains(const T& from, const T& to) const +{ + vertex *fromv = lookup(from); + if (0 == fromv) + return FALSE; + + for (Pix x=fromv->fanout.first(); 0 != x; fromv->fanout.next(x)) { + if (fromv->fanout(x)->item == to) + return TRUE; + } + + return FALSE; +} + +template +vertex * +Graph::lookup(const T& from) const +{ + for (Pix x=vertices.first(); 0 != x; vertices.next(x)) { + if (vertices(x).item == from) + return &vertices(x); + } + return 0; +} + +template +vertex * +Graph::lookup_new(const T& from) +{ + vertex *v = lookup(from); + if (0 == v) { + vertices.append(from); + return &vertices(vertices.last()); + } + return v; +} + +template +Pix +Graph::firstV1(Pix vx) const +{ + vertex *v = (vertex *) vx; + return v->fanout.first(); +} + +template +void +Graph::nextV1(Pix vx, Pix& x) const +{ + vertex *v = (vertex *) vx; + return v->fanout.next(x); +} + +template +T& +Graph::V1(Pix vx, Pix x) const +{ + vertex *v = (vertex *) vx; + static T x1; + return x1; +} + +class STRLIdentifier; + +extern int x(List_DL); +extern int x(List_DLS); + +extern int x(Set); +extern int x(Set_DL); +extern int x(Set_DLp); + +extern int x(Graph); + +class STRLIdentifier { + char buf[10]; +}; + +extern int operator==(vertex&, vertex&); // { dg-error "" } const subversion +extern int operator==(STRLIdentifier&, STRLIdentifier&); // { dg-error "" } fn ref in err msg + +extern int x(List_DLSp); + +template class Graph; +template class List_DLS >;
p1989.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: unroll1.C =================================================================== --- unroll1.C (nonexistent) +++ unroll1.C (revision 816) @@ -0,0 +1,11 @@ +// { dg-do assemble } +// { dg-options "-g -O -funroll-loops" } + +struct A { + inline ~A() { } +}; + +void foo (A) { + while (1) + A bar; +}
unroll1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref1.C =================================================================== --- ref1.C (nonexistent) +++ ref1.C (revision 816) @@ -0,0 +1,22 @@ +// { dg-do run } +int count; + +struct base { + base () { ++count; } + ~base () { --count; } + base(const base&o) { ++count; } +}; + +base base_returning_function (); + +const base& base_ref = base_returning_function (); + +int main () { + if (count != 1) + return 1; +} + +base base_returning_function () { + base local_base_object; + return local_base_object; +}
ref1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net35.C =================================================================== --- net35.C (nonexistent) +++ net35.C (revision 816) @@ -0,0 +1,28 @@ +// { dg-do run } +extern "C" int printf(const char *, ...); + +class A { + public: + char *x; +}; + +class B1:public virtual A { }; + +class B2:public virtual A { }; + +class C:public B1, public B2 { +public: + C() { } +}; + +int main() { + C c; + printf("&c.x = %x\n", &c.x); + printf("&c.B1::x = %x\n", &c.B1::x); + printf("&c.B2::x = %x\n", &c.B2::x); + printf("&c.A::x = %x\n", &c.A::x); + if (&c.x != &c.B1::x + || &c.x != &c.B2::x + || &c.x != &c.A::x) + return 1; +}
net35.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net18.C =================================================================== --- net18.C (nonexistent) +++ net18.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do assemble } + +class ClassA { +public: + typedef ClassA& (*PMFV)(const char*); + static PMFV setMapper(PMFV); + static PMFV _mapper; +}; + +class ClassB { +public: + typedef ClassB& (*PMFV)(const char*); +}; + +ClassA::PMFV ClassA::setMapper(ClassA::PMFV newFunc) +{ + PMFV oldFunc = _mapper; + _mapper = newFunc; + + return oldFunc; +}
net18.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh31.C =================================================================== --- eh31.C (nonexistent) +++ eh31.C (revision 816) @@ -0,0 +1,23 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +int count; + +class Foo { +public: + Foo() { ++count; } + Foo(const Foo&) { ++count; } + ~Foo() { --count; } +}; + + +main() { + try { + throw Foo(); + } + catch (Foo& object) { + if (count == 1) + return 0; + } + return 1; +}
eh31.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p755.C =================================================================== --- p755.C (nonexistent) +++ p755.C (revision 816) @@ -0,0 +1,19 @@ +// { dg-do run } +// It checks to see if you can define your own global new operator. +// prms-id: 755 + +#include + +extern "C" void _exit(int); + +void* operator new(size_t sz) throw (std::bad_alloc) { + void* p = 0; + _exit(0); + return p; +} + +int main () { + int* i = new int; + delete i; + return 1; +}
p755.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh14.C =================================================================== --- eh14.C (nonexistent) +++ eh14.C (revision 816) @@ -0,0 +1,25 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +class arghh { +public: + int n; + arghh (int v) { n = v; } +}; + +int main () { + try { + throw arghh (11); + } + catch (arghh& a) { + if (a.n != 11) + return 1; + } + try { + throw arghh (22); + } + catch (arghh& a) { + if (a.n != 22) + return 2; + } +}
eh14.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pmd1.C =================================================================== --- pmd1.C (nonexistent) +++ pmd1.C (revision 816) @@ -0,0 +1,12 @@ +// { dg-do assemble } + +class A; +struct XX { int A::*py; }; + +class A { +public: + int p; + void setp(XX *xp); +}; + +void A::setp(XX *xp) { xp->py = &A::p; }
pmd1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns2.C =================================================================== --- ns2.C (nonexistent) +++ ns2.C (revision 816) @@ -0,0 +1,10 @@ +// { dg-do run } +namespace N { + int i; +} + +using namespace N; + +int main() { + return i; +}
ns2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh56.C =================================================================== --- eh56.C (nonexistent) +++ eh56.C (revision 816) @@ -0,0 +1,23 @@ +// { dg-do run } +// { dg-options "-fexceptions" } + +struct A { + A() { } + A(const char *) { } + A(const A&) { } + ~A() { } +}; + +struct bmf { + bmf (const A n) { } + ~bmf (void) { } + A name; +}; + +void imf (void) { + bmf Sabs ("abs"); +} + +int main(void) { + imf (); +}
eh56.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: for1.C =================================================================== --- for1.C (nonexistent) +++ for1.C (revision 816) @@ -0,0 +1,4 @@ +// { dg-do assemble } +int main() { + for( {int i = 0; int j = 0;} i < 10; ++i ) ; // { dg-error "" } +}
for1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh39.C =================================================================== --- eh39.C (nonexistent) +++ eh39.C (revision 816) @@ -0,0 +1,28 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +int fail = 1; +class B { +public: + B() { throw 1; } +}; +class D : public B { +public: + D(); +}; + +D::D() try : B() { + fail = 1; +} catch (...) { + fail = 0; + throw; +} + +main() { + try { + D d; + fail = 1; + } catch (...) { + } + return fail; +}
eh39.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pmf6.C =================================================================== --- pmf6.C (nonexistent) +++ pmf6.C (revision 816) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// { dg-options "" } + +class S { +public: + void (S::*pmf)(); + void foo() { + pmf(); // { dg-warning "" } + } + static void foo1(S* sp) { + (sp->pmf)(); // { dg-error "" } + } +};
pmf6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3070.C =================================================================== --- p3070.C (nonexistent) +++ p3070.C (revision 816) @@ -0,0 +1,32 @@ +// { dg-do assemble } +// Caused an Internal Compiler Error. Works now. +// prms-id: 3070 + +class Object { +public: + virtual ~Object() {} +}; + +class BaseView { +protected: + virtual void _forwardReceiveUpdate() = 0; +}; + + +class View : public BaseView { +public: + virtual ~View(); +}; + +class TestViewBaseUpdate { +protected: + virtual void _receiveUpdate(); +}; + +class TestViewBase : public TestViewBaseUpdate, private View { +}; + +class TestView : public Object, public TestViewBase { +protected: + virtual void _receiveUpdate(); +};
p3070.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: net6.C =================================================================== --- net6.C (nonexistent) +++ net6.C (revision 816) @@ -0,0 +1,5 @@ +// { dg-do assemble } +// { dg-options "" } + +struct X {}; +X x = X(); // { dg-bogus "" }
net6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4263.C =================================================================== --- p4263.C (nonexistent) +++ p4263.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// prms-id: 4263 + +enum OT {A_type, B_Type}; +enum AT {A, B}; + +/* These are not ok. */ +OT t = A; // { dg-error "" } +OT e2 = 1; // { dg-error "" } +OT e3 = 1.1; // { dg-error "" } + +/* These are ok. */ +int i = A; +double d = A; +OT e4 = A_type;
p4263.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3524a.C =================================================================== --- p3524a.C (nonexistent) +++ p3524a.C (revision 816) @@ -0,0 +1,25 @@ +// { dg-do assemble } +// Make sure we can initialize a reference to a templated type, that +// requires a conversion from a derived type to a base type. + +// prms-id: 3524 + +struct cc2Vector +{}; + +template +struct ccPair +{ + ccPair (const cc2Vector&); +}; + +struct ccLine : cc2Vector +{ + double distToPoint (const ccPair &); +}; + +void foo () +{ + ccLine l2; + l2.distToPoint (l2); +}
p3524a.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4246.C =================================================================== --- p4246.C (nonexistent) +++ p4246.C (revision 816) @@ -0,0 +1,49 @@ +// { dg-do run } +// prms-id: 4246 + +extern "C" void abort (); +int num_d; + +class A +{ + public: + A() { } + virtual ~A() { } + virtual void id() { } +}; + +class B +{ + public: + B() { } + virtual ~B() { } + virtual void id() { } +}; + +class C : public A, public B +{ + public: + C() { } + virtual ~C() { } + void id() { abort(); } +}; + +class D : public C +{ + public: + D() { ++num_d; } + virtual ~D() { -- num_d; } + void id() { } +}; + +int main() +{ + D* dp2 = new D; + ((B*)dp2)->id(); + delete (B*) dp2; + + B* bp1 = new D; + bp1->id(); + delete bp1; + return num_d != 0; +}
p4246.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bool4.C =================================================================== --- bool4.C (nonexistent) +++ bool4.C (revision 816) @@ -0,0 +1,3 @@ +// { dg-do assemble } + +void foo(bool arg = (1==0)) {}
bool4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p6901.C =================================================================== --- p6901.C (nonexistent) +++ p6901.C (revision 816) @@ -0,0 +1,7 @@ +// { dg-do assemble } +// prms-id: 6901 + +void green() { + for (int i = 0; i < 10; i++) {} + for (int i = 0; i < 10; i++) {} +}
p6901.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p5571.C =================================================================== --- p5571.C (nonexistent) +++ p5571.C (revision 816) @@ -0,0 +1,71 @@ +// { dg-do run } +// prms-id: 5571 + +int err = 0; +void *vp = 0; + +class ParentOne { +public: + ParentOne() {}; +#ifdef MAKE_WORK + virtual ~ParentOne() {}; +#endif +private: + char SomeData[101]; +}; + +class ParentTwo { +public: + ParentTwo() {}; + virtual ~ParentTwo() {}; +private: + int MoreData[12]; + virtual int foo() { return 0; } +}; + +struct Child : public ParentOne, public ParentTwo { + int ChildsToy; + virtual void PrintThis() = 0; +}; + +struct Student : public Child { + int StudentsBook; + void PrintThis() { + if (vp == 0) + vp = (void *)this; + else + { + if (vp != (void *)this) + ++err; + } + } + void LocalPrintThis() { + if (vp == 0) + vp = (void *)this; + else + { + if (vp != (void *)this) + ++err; + } + PrintThis(); + } + void ForcedPrintThis() { + if (vp == 0) + vp = (void *)this; + else + { + if (vp != (void *)this) + ++err; + } + Student::PrintThis(); + } +}; + +int main() { + Student o; + o.LocalPrintThis(); + o.ForcedPrintThis(); + Child* pX = &o; + pX->PrintThis(); + return err; +}
p5571.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: eh5.C =================================================================== --- eh5.C (nonexistent) +++ eh5.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-options "-fexceptions" } + +class foo { +public: + class error {}; + + void cause_error(void) { throw "Hello World!"; } +}; + +int main(void) +{ + foo f; + try { + f.cause_error(); + } + catch (const char cp[]) { + return 0; + } + return 1; +}
eh5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p4484.C =================================================================== --- p4484.C (nonexistent) +++ p4484.C (revision 816) @@ -0,0 +1,26 @@ +// { dg-do assemble } +// prms-id: 4484 + +class A { + char buf[64]; +}; + +typedef void (A::*pmf)(); +typedef void (A::*pmfc)() const; + +pmfc p = (pmfc)(pmf)0; + +class B { +}; + +class D : public A, public B { +}; + +typedef int (B::*bmfp)(); +typedef int (D::*dmfp)(); + +bmfp foo; + +void bar(dmfp a) { + bar(foo); +}
p4484.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3836.C =================================================================== --- p3836.C (nonexistent) +++ p3836.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// prms-id: 3836 + +void f(int &i) { // { dg-error "" } ref line + i = 10; +} + +int main() +{ + int i=1, j=2; + f(i); + f((int)j); // { dg-error "" } passing in to non-const + if (j != 2) + return 1; +}
p3836.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3708b.C =================================================================== --- p3708b.C (nonexistent) +++ p3708b.C (revision 816) @@ -0,0 +1,86 @@ +// { dg-do run } +// prms-id: 3708 + +extern "C" int printf (const char *, ...); +extern "C" void exit(int); + +void *ptr; + +class A { +public: + A() { printf ("A is constructed.\n"); } + virtual void xx(int doit) { printf ("A is destructed.\n"); } +}; + +class A1 { +public: + A1() { printf ("A1 is constructed.\n"); } + virtual void xx(int doit) { printf ("A1 is destructed.\n"); } +}; + +class B : public virtual A, public A1 { +public: + B() { printf ("B is constructed.\n"); } + virtual void xx(int doit) { + printf ("B is destructed.\n"); + A1::xx (1); + if (doit) A::xx (1); + } +}; + +int num; + +class C : public virtual A { +public: + C() { printf ("C is constructed.\n"); + } + virtual void xx(int doit) { + printf ("C is destructed.\n"); + if (doit) A::xx (1); + } +}; + +class D : public C, public B { +public: + D() { ++num; printf ("D is constructed.\n"); + ptr = this; + } + virtual void xx(int doit) { + --num; + if (ptr != this) { + printf("FAIL\n%x != %x\n", ptr, this); + exit(1); + } + printf ("D is destructed.\n"); + C::xx (0); + B::xx (0); + } +}; + +void fooA(A *a) { + printf ("Casting to A!\n"); + a->xx (1); +} +void fooA1(A1 *a) { + printf ("Casting to A1!\n"); + a->xx (1); +} + +void fooB(B *b) { + printf ("Casting to B!\n"); + b->xx (1); +} + +void fooC(C *c) { + printf ("Casting to C!\n"); + c->xx (1); +} + +int main(int argc, char *argv[]) { + printf ("*** Construct D object!\n"); + D *d = new D(); + + printf ("*** Try to delete the casting pointer!\n"); + fooA1(d); + return num!=0; +}
p3708b.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p3538a.C =================================================================== --- p3538a.C (nonexistent) +++ p3538a.C (revision 816) @@ -0,0 +1,33 @@ +// { dg-do assemble } +// This tests for the compiler_error in binfo_value. +// prms-id: 3538 + +class ccObjectInfo +{ +public: + virtual const ccObjectInfo& repInvariant (int); +}; + +template +class ccHandle : public ccObjectInfo +{ +protected: + T* p; +public: + virtual const ccObjectInfo& repInvariant (int); +}; + +template +const ccObjectInfo& ccHandle::repInvariant (int) +{ return p->ri(1); } + +class ccHandleBase : public ccObjectInfo +{}; + +class cc_CircleHdl : public virtual ccHandleBase, public ccObjectInfo +{ // { dg-warning "" } +public: + virtual const ccObjectInfo& ri (int); +}; + +class ccCircleHdl : public ccHandle {};
p3538a.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mangle2.C =================================================================== --- mangle2.C (nonexistent) +++ mangle2.C (revision 816) @@ -0,0 +1,17 @@ +// { dg-do assemble } +// { dg-options "" } + +typedef struct { +} color; + +void foo(color) { +} + +#ifdef sparc +void f1() asm("foo__FG3$_0"); +void f1() { } +void f2() asm("_foo__FG3$_0"); +void f2() { } +void f3() asm("__foo__FG3$_0"); +void f3() { } +#endif
mangle2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p7476.C =================================================================== --- p7476.C (nonexistent) +++ p7476.C (revision 816) @@ -0,0 +1,20 @@ +// { dg-do assemble } +// prms-id: 7476 + +class HeapTracked { +public: + virtual ~HeapTracked() { } + static void isObjectAllocation(const HeapTracked *ptr); + static void isObjectAllocation(HeapTracked *ptr); +}; + +void HeapTracked::isObjectAllocation(HeapTracked *ptr) +{ + dynamic_cast(ptr); + dynamic_cast(ptr); +} +void HeapTracked::isObjectAllocation(const HeapTracked *ptr) +{ + const_cast(dynamic_cast(ptr)); + dynamic_cast(ptr); // { dg-error "" } +}
p7476.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p9732c.C =================================================================== --- p9732c.C (nonexistent) +++ p9732c.C (revision 816) @@ -0,0 +1,5 @@ +// { dg-do assemble } +// prms-id: 9732 + +struct foo {}; +foo& x() { return foo(); } // { dg-warning "" }
p9732c.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p8269.C =================================================================== --- p8269.C (nonexistent) +++ p8269.C (revision 816) @@ -0,0 +1,11 @@ +// { dg-do assemble } +// prms-id: 8269 + +typedef char* const char_ptr; + +class Foo_Bar { +public: + static char* const counter; +}; + +char_ptr Foo_Bar::counter = 0;
p8269.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dyncast4.C =================================================================== --- dyncast4.C (nonexistent) +++ dyncast4.C (revision 816) @@ -0,0 +1,5 @@ +// { dg-do assemble } +int main() { + int* d; + dynamic_cast(d); // { dg-error "" } +}
dyncast4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: p11144.C =================================================================== --- p11144.C (nonexistent) +++ p11144.C (revision 816) @@ -0,0 +1,18 @@ +// { dg-do run } +// { dg-options "-O" } +// prms-id: 11144 + +class Id { +public: + int d_i; + Id(int i) : d_i(i) {} + int value() {return d_i;} +} ID(1); + +Id foo() { return ID; } + +int main() { + const Id &id1 = foo(); + const Id &id2 = foo(); + return &id1 == &id2; +}
p11144.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.