summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.martin
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.old-deja/g++.martin
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.martin')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/access1.C12
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/ambig1.C22
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/bitset1.C10
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/conv1.C14
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/crash1.C15
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/eval1.C21
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/lookup1.C22
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/new1.C122
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/overload1.C13
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/pmf1.C19
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/pmf2.C22
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/pure1.C8
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/sts_conv.C20
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/sts_iarr.C46
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/sts_partial.C15
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/sts_vectini.C42
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/typedef1.C14
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/typedef2.C7
18 files changed, 444 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/access1.C b/gcc/testsuite/g++.old-deja/g++.martin/access1.C
new file mode 100644
index 000000000..9927b7156
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/access1.C
@@ -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){}
+ };
+};
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/ambig1.C b/gcc/testsuite/g++.old-deja/g++.martin/ambig1.C
new file mode 100644
index 000000000..1ccc217a4
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/ambig1.C
@@ -0,0 +1,22 @@
+// { dg-do assemble }
+//Based on a report by Bill Currie <bcurrie@tssc.co.nz>
+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
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/bitset1.C b/gcc/testsuite/g++.old-deja/g++.martin/bitset1.C
new file mode 100644
index 000000000..c8be0bf88
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/bitset1.C
@@ -0,0 +1,10 @@
+// { dg-do run }
+// Origin: Jeff Donner <jdonner@schedsys.com>
+#include <bitset>
+
+int main()
+{
+ std::bitset<sizeof(int) * 8> bufWord;
+
+ bufWord[3] = 0;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/conv1.C b/gcc/testsuite/g++.old-deja/g++.martin/conv1.C
new file mode 100644
index 000000000..552e47b46
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/conv1.C
@@ -0,0 +1,14 @@
+// { dg-do run }
+struct S{
+ operator bool()
+ {
+ return true;
+ }
+};
+
+int main()
+{
+ S a;
+ if (S &b = a);
+}
+
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/crash1.C b/gcc/testsuite/g++.old-deja/g++.martin/crash1.C
new file mode 100644
index 000000000..5a81d7ed8
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/crash1.C
@@ -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();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/eval1.C b/gcc/testsuite/g++.old-deja/g++.martin/eval1.C
new file mode 100644
index 000000000..e3eb3d6be
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/eval1.C
@@ -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;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/lookup1.C b/gcc/testsuite/g++.old-deja/g++.martin/lookup1.C
new file mode 100644
index 000000000..cb5eb07c9
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/lookup1.C
@@ -0,0 +1,22 @@
+// { dg-do assemble }
+//In the base class list, the context of the current is used
+//reported by Stephen Vavasis <vavasis@CS.Cornell.EDU>
+
+namespace N1 {
+ namespace N2 {
+ class A{};
+ class B;
+ }
+}
+
+class N1::N2::B : public A {
+};
+
+
+class C1 {
+ class A{};
+ class B;
+};
+
+class C1::B : A {
+};
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/new1.C b/gcc/testsuite/g++.old-deja/g++.martin/new1.C
new file mode 100644
index 000000000..502c4f42a
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/new1.C
@@ -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 <new>
+#include <cstdlib>
+#include <cstdio>
+
+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;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/overload1.C b/gcc/testsuite/g++.old-deja/g++.martin/overload1.C
new file mode 100644
index 000000000..782c8bf4e
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/overload1.C
@@ -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);
+}
+
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/pmf1.C b/gcc/testsuite/g++.old-deja/g++.martin/pmf1.C
new file mode 100644
index 000000000..108754b28
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/pmf1.C
@@ -0,0 +1,19 @@
+// { dg-do run }
+// Based on a test case by Andrew Bell <andrew.bell@bigfoot.com>
+// 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<void (B::*)()>(&D::foo);
+ (b->*f)();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/pmf2.C b/gcc/testsuite/g++.old-deja/g++.martin/pmf2.C
new file mode 100644
index 000000000..e52ce9f61
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/pmf2.C
@@ -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;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/pure1.C b/gcc/testsuite/g++.old-deja/g++.martin/pure1.C
new file mode 100644
index 000000000..f19ff0ab7
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/pure1.C
@@ -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
+};
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/sts_conv.C b/gcc/testsuite/g++.old-deja/g++.martin/sts_conv.C
new file mode 100644
index 000000000..93cad839f
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/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;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/sts_iarr.C b/gcc/testsuite/g++.old-deja/g++.martin/sts_iarr.C
new file mode 100644
index 000000000..77ae5ae59
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/sts_iarr.C
@@ -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 <int N>
+struct Outer{
+ struct Inner{
+ Inner(int n): sum(n){}
+
+ typename Outer<N-1>::Inner operator[](int n) const
+ { return typename Outer<N-1>::Inner(sum + n); }
+
+ int sum;
+ };
+
+ typename Outer<N-1>::Inner operator[](int n) const
+ { return typename Outer<N-1>::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;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/sts_partial.C b/gcc/testsuite/g++.old-deja/g++.martin/sts_partial.C
new file mode 100644
index 000000000..00b58e6c2
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/sts_partial.C
@@ -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<class T>
+int f(T &){ return 1; }
+
+template<class T>
+int f( T[] ){ return 0; }
+
+int main(){
+ int d[] ={2};
+ return f(d);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/sts_vectini.C b/gcc/testsuite/g++.old-deja/g++.martin/sts_vectini.C
new file mode 100644
index 000000000..b8ab3534a
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/sts_vectini.C
@@ -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);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/typedef1.C b/gcc/testsuite/g++.old-deja/g++.martin/typedef1.C
new file mode 100644
index 000000000..990c0bb6c
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/typedef1.C
@@ -0,0 +1,14 @@
+// { dg-do assemble }
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 31 Mar 1999 <nathan@acm.org>
+
+// Make sure we see through typedefs.
+
+typedef int Int;
+
+void fn()
+{
+ int *p;
+ Int *&pr2 = p;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/typedef2.C b/gcc/testsuite/g++.old-deja/g++.martin/typedef2.C
new file mode 100644
index 000000000..be1bbcbf7
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/typedef2.C
@@ -0,0 +1,7 @@
+// { dg-do assemble }
+// Testcase from Alexander Zvyagin <zvyagin@mx.ihep.su>
+// Check implicit conversion from string constants into typedefs
+
+typedef char CHAR;
+void f2(CHAR *s="");
+