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

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/tags/gnu-src/gcc-4.5.1/gcc-4.5.1-or32-1.0rc1/gcc/testsuite/g++.old-deja/g++.martin
    from Rev 305 to Rev 338
    Reverse comparison

Rev 305 → Rev 338

/sts_conv.C
0,0 → 1,20
// { dg-do run }
// ecgs-bugs 1999-02-22 14:21, Stefan Schwarzer
// sts@ica1.uni-stuttgart.de
// this code should compile quietly
 
class CArray
{
public:
operator double* (){ return a; }
// works if we comment this line:
operator double* () const { return const_cast<double *>(a); }
private:
double a[2];
};
 
int main(){
CArray a;
double *pa = a + 1; // { dg-bogus "" } should convert
return 0;
}
sts_conv.C Property changes : Added: svn:eol-style ## -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 338) @@ -0,0 +1,22 @@ +// { dg-do assemble } +//Based on a report by Bill Currie +struct foo { + protected: + int x; // { dg-error "" } candidate +}; + +struct bar { + public: + int x(); // { dg-error "" } candidate +}; + +struct foobar: public foo, public bar { + foobar(); +}; + +int func(int); + +foobar::foobar() +{ + func(x); // { dg-error "" } ambiguous member access +}
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: pmf1.C =================================================================== --- pmf1.C (nonexistent) +++ pmf1.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do run } +// Based on a test case by Andrew Bell +// Check for pointer-to-virtual-function calls on +// bases without virtual functions. + +struct B{}; + +struct D: public B{ + virtual void foo(); +}; + +void D::foo(){} + +int main() +{ + B *b = new D; + void (B::*f)() = static_cast(&D::foo); + (b->*f)(); +}
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: pmf2.C =================================================================== --- pmf2.C (nonexistent) +++ pmf2.C (revision 338) @@ -0,0 +1,22 @@ +// { dg-do run } +// { dg-options "-Wno-pmf-conversions" } +// Test conversion of pointers to virtual member functions to +// pointers to non-member functions. + +struct A{ + int i; + A () :i(1){} + virtual void foo(); +}a; + +void A::foo() +{ + i = 0; +} + +int main() +{ + void (*f)(A*) = (void(*)(A*))(&A::foo); + f(&a); + return a.i; +}
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: eval1.C =================================================================== --- eval1.C (nonexistent) +++ eval1.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do run } +// Postfix expression must be evaluated even if accessing a static member. + +struct S +{ + static int i; + S* foo(); +}; + +S* S::foo(){ + i = 0; + return this; +} + +int S::i = 1; +int main(void) +{ + S * s = new S; + int k=(s->foo())->i; + return k; +}
eval1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new1.C =================================================================== --- new1.C (nonexistent) +++ new1.C (revision 338) @@ -0,0 +1,122 @@ +// { dg-do run } +//Lifetime of temporaries: +//egcs 2.92 performs cleanup for temporaries inside new expressions +//after the new is complete, not at the end of the full expression. + +#include +#include +#include + +bool new_throws; +bool ctor_throws; + +int new_done; +int ctor_done; +int func_done; +int dtor_done; +int delete_done; + +int count; + +void init() +{ + new_throws = ctor_throws = false; + new_done = ctor_done = func_done = dtor_done = delete_done = count = 0; +} + +struct line_error{ + int line; + line_error(int i):line(i){} +}; + +#define CHECK(cond) if(!(cond))throw line_error(__LINE__); + +struct A{ + A(int){ + ctor_done = ++count; + if(ctor_throws) + throw 1; + } + A(const A&){ + CHECK(false); //no copy constructors in this code + } + ~A(){ + dtor_done = ++count; + } + A* addr(){return this;} +}; + +struct B{ + B(A*){} + void* operator new(size_t s){ + new_done = ++count; + if(new_throws) + throw 1; + return malloc(s); + } + void operator delete(void *){ + delete_done = ++count; + } +}; + +void func(B* ) +{ + func_done = ++count; +} + +void test1() +{ + init(); + try{ + func(new B(A(10).addr())); + }catch(int){ + } + CHECK(ctor_done==1); + CHECK(new_done==2); + CHECK(func_done==3); + CHECK(dtor_done==4); + CHECK(delete_done==0); +} + +void test2() +{ + init(); + new_throws = true; + try{ + func(new B(A(10).addr())); + }catch(int){ + } + CHECK(ctor_done==1); + CHECK(new_done==2); + CHECK(func_done==0); + CHECK(dtor_done==3); + CHECK(delete_done==0); +} + +void test3() +{ + init(); + ctor_throws = true; + try{ + func(new B(A(10).addr())); + }catch(int){ + } + CHECK(new_done==0); + CHECK(ctor_done==1); + CHECK(func_done==0); + CHECK(dtor_done==0); + CHECK(delete_done==0); +} + +int main() +{ + try{ + test1(); + test2(); + test3(); + }catch(line_error e){ + printf("Got error in line %d\n",e.line); + return 1; + } + return 0; +}
new1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bitset1.C =================================================================== --- bitset1.C (nonexistent) +++ bitset1.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do run } +// Origin: Jeff Donner +#include + +int main() +{ + std::bitset bufWord; + + bufWord[3] = 0; +}
bitset1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: typedef1.C =================================================================== --- typedef1.C (nonexistent) +++ typedef1.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 31 Mar 1999 + +// Make sure we see through typedefs. + +typedef int Int; + +void fn() +{ + int *p; + Int *&pr2 = p; +}
typedef1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: crash1.C =================================================================== --- crash1.C (nonexistent) +++ crash1.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } +int i = 4; +struct S{ + char c[i]; // { dg-error "" } size not constant + int h; + int foo(){ + return h; + } +}; + +int main() +{ + S x; + int i = x.foo(); +}
crash1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: typedef2.C =================================================================== --- typedef2.C (nonexistent) +++ typedef2.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble } +// Testcase from Alexander Zvyagin +// Check implicit conversion from string constants into typedefs + +typedef char CHAR; +void f2(CHAR *s=""); +
typedef2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: access1.C =================================================================== --- access1.C (nonexistent) +++ access1.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } +class A{ + public: + enum Foo{f1,f2}; + + class B{ + friend class A; + Foo f; + public: + B():f(f1){} + }; +};
access1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: sts_partial.C =================================================================== --- sts_partial.C (nonexistent) +++ sts_partial.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do run } +// ecgs-bugs 1999-02-22 14:26 Stefan Schwarzer +// sts@ica1.uni-stuttgart.de +// partial ordering problem in egcs <= 1.1.1 + +template +int f(T &){ return 1; } + +template +int f( T[] ){ return 0; } + +int main(){ + int d[] ={2}; + return f(d); +}
sts_partial.C Property changes : Added: svn:eol-style ## -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 338) @@ -0,0 +1,14 @@ +// { dg-do run } +struct S{ + operator bool() + { + return true; + } +}; + +int main() +{ + S a; + if (S &b = a); +} +
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: sts_iarr.C =================================================================== --- sts_iarr.C (nonexistent) +++ sts_iarr.C (revision 338) @@ -0,0 +1,46 @@ +// { dg-do run } +// egcs-bugs 999-02-22 14:26 Stefan Schwarzer +// sts@ica1.uni-stuttgart.de +// should compile and return 0 + +template +struct Outer{ + struct Inner{ + Inner(int n): sum(n){} + + typename Outer::Inner operator[](int n) const + { return typename Outer::Inner(sum + n); } + + int sum; + }; + + typename Outer::Inner operator[](int n) const + { return typename Outer::Inner(n); } +}; + + +// specializations for N==1 +template<> +struct Outer<1> { + struct Inner { + Inner(int n): sum(n){} + + int operator[](int n) const + { return sum+n; } + + int sum; + }; + + int operator[](int n) const + { return n; } +}; + + +int main() +{ + Outer<1> sum1; + //std::cout << sum1[1] << "\n"; + Outer<2> sum2; + //std::cout << sum2[1][1] << "\n"; + return sum1[1] + sum2[1][1] - 3; +}
sts_iarr.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: lookup1.C =================================================================== --- lookup1.C (nonexistent) +++ lookup1.C (revision 338) @@ -0,0 +1,22 @@ +// { dg-do assemble } +//In the base class list, the context of the current is used +//reported by Stephen Vavasis + +namespace N1 { + namespace N2 { + class A{}; + class B; + } +} + +class N1::N2::B : public A { +}; + + +class C1 { + class A{}; + class B; +}; + +class C1::B : A { +};
lookup1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: sts_vectini.C =================================================================== --- sts_vectini.C (nonexistent) +++ sts_vectini.C (revision 338) @@ -0,0 +1,42 @@ +// { dg-do run } +// { dg-options "-O2 -w" } +// egcs-bugs 1999-02-22 14:24 Stefan Schwarzer +// sts@ica1.uni-stuttgart.de +// optimizer problem in egcs <= 1.1.1 + +struct XTVec{ + XTVec(){x[0]=x[1] =x[2] =0;} + XTVec(int ax,int y=0.,int z=0.){x[0]=ax;x[1]=y; x[2]=z; } + int& operator[](int); + + int x[3]; +}; + +inline +int & XTVec::operator[](int i){ + return x[i]; +} + +inline +XTVec& operator+=(XTVec& lhs, XTVec& rhs){ + lhs[0]+=rhs[0]; + lhs[1]+=rhs[1]; + lhs[2]+=rhs[2]; + return lhs; +} + +inline +XTVec operator+(XTVec& lhs, XTVec& rhs){ + XTVec result(lhs); + return result += rhs; +} + +int main() +{ + XTVec ur(4.,0.,1.); + XTVec ll(0.,2.,0.); + XTVec initsum(ur + ll); + + // sum of components should be 7 + return (initsum[0] + initsum[1] + initsum[2] - 7); +}
sts_vectini.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pure1.C =================================================================== --- pure1.C (nonexistent) +++ pure1.C (revision 338) @@ -0,0 +1,8 @@ +// { dg-do assemble } +class A +{ + public: + virtual void f(void) = 0; // pure virtual function. + A() {f();} // { dg-warning "const" } called in a constructor + ~A() {f();} // { dg-warning "destr" } called in a destructor +};
pure1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: overload1.C =================================================================== --- overload1.C (nonexistent) +++ overload1.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do run } +//Overload resolution should consider both declarations of func identically. + +struct S{}; +void func(S&){} + +int main() +{ + void func(S&); + S s; + func(s); +} +
overload1.C Property changes : Added: svn:eol-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.