eh5.C: New test.
* g++.old-deja/g++.other/eh5.C: New test. * g++.old-deja/g++.other/sibcall2.C: New test. * g++.old-deja/g++.other/array9.C: New test. * g++.old-deja/g++.other/typename2.C: New test. * g++.old-deja/g++.other/crash60.C: New test. * g++.old-deja/g++.other/conv9.C: New test. * g++.old-deja/g++.other/mangle10.C: New test. * g++.old-deja/g++.other/unchanging1.C: New test. * g++.old-deja/g++.other/exprstmt1.C: New test. * g++.old-deja/g++.other/inline23.C: New test. * g++.old-deja/g++.eh/ia64-1.C: New test. * g++.old-deja/g++.other/dwarf2-1.C: New test. * g++.old-deja/g++.other/mangle11.C: New test. * g++.old-deja/g++.other/reload1.C: New test. * g++.old-deja/g++.other/static20.C: New test. * g++.old-deja/g++.other/local-alloc1.C: New test. * g++.old-deja/g++.other/conv8.C: New test. * g++.old-deja/g++.other/stmtexpr2.C: New test. * g++.old-deja/g++.other/storeexpr1.C: New test. * g++.old-deja/g++.other/storeexpr2.C: New test. * g++.dg/eh/template2.C: New test. * g++.dg/warn/weak1.C: New test. From-SVN: r49211
This commit is contained in:
parent
b5b59800c2
commit
1658df0aca
23 changed files with 695 additions and 0 deletions
|
@ -1,3 +1,28 @@
|
|||
2002-01-25 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* g++.old-deja/g++.other/eh5.C: New test.
|
||||
* g++.old-deja/g++.other/sibcall2.C: New test.
|
||||
* g++.old-deja/g++.other/array9.C: New test.
|
||||
* g++.old-deja/g++.other/typename2.C: New test.
|
||||
* g++.old-deja/g++.other/crash60.C: New test.
|
||||
* g++.old-deja/g++.other/conv9.C: New test.
|
||||
* g++.old-deja/g++.other/mangle10.C: New test.
|
||||
* g++.old-deja/g++.other/unchanging1.C: New test.
|
||||
* g++.old-deja/g++.other/exprstmt1.C: New test.
|
||||
* g++.old-deja/g++.other/inline23.C: New test.
|
||||
* g++.old-deja/g++.eh/ia64-1.C: New test.
|
||||
* g++.old-deja/g++.other/dwarf2-1.C: New test.
|
||||
* g++.old-deja/g++.other/mangle11.C: New test.
|
||||
* g++.old-deja/g++.other/reload1.C: New test.
|
||||
* g++.old-deja/g++.other/static20.C: New test.
|
||||
* g++.old-deja/g++.other/local-alloc1.C: New test.
|
||||
* g++.old-deja/g++.other/conv8.C: New test.
|
||||
* g++.old-deja/g++.other/stmtexpr2.C: New test.
|
||||
* g++.old-deja/g++.other/storeexpr1.C: New test.
|
||||
* g++.old-deja/g++.other/storeexpr2.C: New test.
|
||||
* g++.dg/eh/template2.C: New test.
|
||||
* g++.dg/warn/weak1.C: New test.
|
||||
|
||||
2002-01-25 Hans-Peter Nilsson <hp@bitrange.com>
|
||||
|
||||
* lib/scanasm.exp (scan-assembler-dem, scan-assembler-dem-not):
|
||||
|
|
19
gcc/testsuite/g++.dg/eh/template2.C
Normal file
19
gcc/testsuite/g++.dg/eh/template2.C
Normal file
|
@ -0,0 +1,19 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options -O2 }
|
||||
|
||||
template<class T> struct O {
|
||||
O(T *p) : q(p) { }
|
||||
T *q;
|
||||
};
|
||||
struct W {
|
||||
virtual ~W();
|
||||
};
|
||||
struct S : public W {
|
||||
S (int *);
|
||||
};
|
||||
W *bar(int);
|
||||
S::S (int *x)
|
||||
{
|
||||
for (int *p = x; *p; p++)
|
||||
O<W> i (bar (*p));
|
||||
}
|
12
gcc/testsuite/g++.dg/warn/weak1.C
Normal file
12
gcc/testsuite/g++.dg/warn/weak1.C
Normal file
|
@ -0,0 +1,12 @@
|
|||
// { dg-do run }
|
||||
|
||||
extern void foo (void) __attribute__ ((weak));
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
if (&foo)
|
||||
foo ();
|
||||
|
||||
return 0;
|
||||
}
|
72
gcc/testsuite/g++.old-deja/g++.eh/ia64-1.C
Normal file
72
gcc/testsuite/g++.old-deja/g++.eh/ia64-1.C
Normal file
|
@ -0,0 +1,72 @@
|
|||
// Special g++ Options: -O2
|
||||
|
||||
#include <exception>
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern "C" void abort();
|
||||
|
||||
int i0, i1, i2, i3, i4, i5, i6, i7, i8, i9;
|
||||
int j0, j1, j2, j3, j4, j5, j6, j7, j8, j9;
|
||||
int k0, k1, k2, k3, k4, k5, k6, k7, k8, k9;
|
||||
int l0, l1, l2, l3, l4, l5, l6, l7, l8, l9;
|
||||
#define A(x,y,n) register int *x##n = &y##n;
|
||||
#define B(x,y) \
|
||||
A(x,y,0) A(x,y,1) A(x,y,2) A(x,y,3) A(x,y,4) \
|
||||
A(x,y,5) A(x,y,6) A(x,y,7) A(x,y,8) A(x,y,9)
|
||||
#define C(x,n) asm volatile ("" : "=r" (x##n) : "0" (x##n));
|
||||
#define D(x) \
|
||||
C(x,0) C(x,1) C(x,2) C(x,3) C(x,4) \
|
||||
C(x,5) C(x,6) C(x,7) C(x,8) C(x,9)
|
||||
#define E(x,y,n) if (x##n != &y##n) abort ();
|
||||
#define F(x,y) \
|
||||
E(x,y,0) E(x,y,1) E(x,y,2) E(x,y,3) E(x,y,4) \
|
||||
E(x,y,5) E(x,y,6) E(x,y,7) E(x,y,8) E(x,y,9)
|
||||
|
||||
void bar(long a0, long a1, long a2, long a3, long a4)
|
||||
{
|
||||
}
|
||||
|
||||
void foo(long a0, long a1, long a2, long a3, long a4)
|
||||
{
|
||||
A(p,l,0) A(p,l,1) A(p,l,2)
|
||||
C(p,0) C(p,1) C(p,2)
|
||||
bar (0, 1, 2, 3, 4);
|
||||
if (a0 == 0)
|
||||
throw exception();
|
||||
C(p,0) C(p,1) C(p,2)
|
||||
E(p,l,0) E(p,l,1) E(p,l,2)
|
||||
}
|
||||
|
||||
void test(void)
|
||||
{
|
||||
A(p,l,0) A(p,l,1) A(p,l,2) A(p,l,3) A(p,l,4) A(p,l,5) A(p,l,6)
|
||||
C(p,0) C(p,1) C(p,2) C(p,3) C(p,4) C(p,5) C(p,6)
|
||||
try {
|
||||
foo(0, 1, 2, 3, 4);
|
||||
} catch (exception) {}
|
||||
C(p,0) C(p,1) C(p,2) C(p,3) C(p,4) C(p,5) C(p,6)
|
||||
E(p,l,0) E(p,l,1) E(p,l,2) E(p,l,3) E(p,l,4) E(p,l,5) E(p,l,6)
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
B(x,i)
|
||||
B(y,j)
|
||||
B(z,k)
|
||||
A(p,l,0) A(p,l,1) A(p,l,2) A(p,l,3)
|
||||
D(x)
|
||||
D(y)
|
||||
D(z)
|
||||
C(p,0) C(p,1) C(p,2) C(p,3)
|
||||
test();
|
||||
D(x)
|
||||
D(y)
|
||||
D(z)
|
||||
C(p,0) C(p,1) C(p,2) C(p,3)
|
||||
F(x,i)
|
||||
F(y,j)
|
||||
F(z,k)
|
||||
E(p,l,0) E(p,l,1) E(p,l,2) E(p,l,3)
|
||||
return 0;
|
||||
}
|
6
gcc/testsuite/g++.old-deja/g++.other/array9.C
Normal file
6
gcc/testsuite/g++.old-deja/g++.other/array9.C
Normal file
|
@ -0,0 +1,6 @@
|
|||
// Build don't link:
|
||||
|
||||
template <class T> class A {
|
||||
T *d;
|
||||
public: void f() { (T[10])d; }
|
||||
};
|
31
gcc/testsuite/g++.old-deja/g++.other/conv8.C
Normal file
31
gcc/testsuite/g++.old-deja/g++.other/conv8.C
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Build don't link:
|
||||
// Origin: Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
class bar
|
||||
{
|
||||
public:
|
||||
bar();
|
||||
virtual ~bar();
|
||||
static void a();
|
||||
};
|
||||
|
||||
class baz : public bar
|
||||
{
|
||||
};
|
||||
|
||||
class foo : virtual public baz
|
||||
{
|
||||
public:
|
||||
static void a();
|
||||
void b();
|
||||
};
|
||||
|
||||
typedef void (bar::*T)();
|
||||
T d;
|
||||
|
||||
void foo::a()
|
||||
{
|
||||
typedef void(foo::*t)();
|
||||
t c = & foo::b;
|
||||
d = (T) c; // WARNING - pointer to member cast
|
||||
}
|
31
gcc/testsuite/g++.old-deja/g++.other/conv9.C
Normal file
31
gcc/testsuite/g++.old-deja/g++.other/conv9.C
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Build don't link:
|
||||
|
||||
struct
|
||||
Foo
|
||||
{
|
||||
public:
|
||||
typedef void* (*copier_fn)(void const*);
|
||||
void foo() const;
|
||||
void bar(char const*, void const*) const;
|
||||
private:
|
||||
struct
|
||||
Bar
|
||||
{
|
||||
char const* key;
|
||||
void const* item;
|
||||
};
|
||||
};
|
||||
|
||||
void
|
||||
Foo::foo() const
|
||||
{
|
||||
Bar* cp = 0;
|
||||
copier_fn copyfn = 0;
|
||||
|
||||
bar(cp->key, cp->item);
|
||||
bar(cp->key, (copyfn) ? (*copyfn)(cp) : 0);
|
||||
bar(cp->key, (copyfn) ? (*copyfn)(0) : 0);
|
||||
|
||||
bar(cp->key, (copyfn) ? (*copyfn)(0) : cp->item);
|
||||
bar(cp->key, (copyfn) ? (*copyfn)(cp) : cp->item);
|
||||
}
|
7
gcc/testsuite/g++.old-deja/g++.other/crash60.C
Normal file
7
gcc/testsuite/g++.old-deja/g++.other/crash60.C
Normal file
|
@ -0,0 +1,7 @@
|
|||
// Build don't link:
|
||||
|
||||
void foo ()
|
||||
{
|
||||
int e;
|
||||
e := e; // ERROR - parse error
|
||||
}
|
11
gcc/testsuite/g++.old-deja/g++.other/dwarf2-1.C
Normal file
11
gcc/testsuite/g++.old-deja/g++.other/dwarf2-1.C
Normal file
|
@ -0,0 +1,11 @@
|
|||
// Build don't link:
|
||||
// Special g++ Options: -gdwarf-2 -O0
|
||||
|
||||
int foo()
|
||||
{
|
||||
int a = 1;
|
||||
int b = 1;
|
||||
int e[a][b];
|
||||
e[0][0] = 0;
|
||||
return e[a-1][b-1];
|
||||
}
|
34
gcc/testsuite/g++.old-deja/g++.other/eh5.C
Normal file
34
gcc/testsuite/g++.old-deja/g++.other/eh5.C
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Build don't link:
|
||||
// Special g++ Options: -O2
|
||||
|
||||
struct X {};
|
||||
|
||||
struct Y
|
||||
{
|
||||
Y();
|
||||
virtual ~Y();
|
||||
};
|
||||
|
||||
struct Z
|
||||
{
|
||||
int f (const int *x);
|
||||
int g;
|
||||
};
|
||||
|
||||
inline int
|
||||
operator<< (Z &os, int x)
|
||||
{
|
||||
os.f (&x);
|
||||
return os.g;
|
||||
}
|
||||
|
||||
void foo (Z &a, X *b, X &c)
|
||||
{
|
||||
X *d = b;
|
||||
int e = 0;
|
||||
Z &f = a;
|
||||
if (!(f << e))
|
||||
do { do { } while (&c == 0); throw Y(); } while (0);
|
||||
do { } while (&d == 0);
|
||||
do { } while (&c == 0);
|
||||
}
|
23
gcc/testsuite/g++.old-deja/g++.other/exprstmt1.C
Normal file
23
gcc/testsuite/g++.old-deja/g++.other/exprstmt1.C
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Special g++ Options: -O
|
||||
|
||||
int main()
|
||||
{
|
||||
unsigned int x = 1381237248;
|
||||
|
||||
if (sizeof (x) != 4)
|
||||
return 0;
|
||||
|
||||
x =
|
||||
({
|
||||
unsigned int y = x;
|
||||
({
|
||||
unsigned int z = y;
|
||||
(unsigned int)
|
||||
((((unsigned int)z & (unsigned int)0x000000ffUL) << 24)
|
||||
| (((unsigned int)z & (unsigned int)0x0000ff00UL) << 8)
|
||||
| (((unsigned int)z & (unsigned int)0x00ff0000UL) >> 8)
|
||||
| (((unsigned int)z & (unsigned int)0xff000000UL) >> 24));
|
||||
});
|
||||
});
|
||||
return x != 152658;
|
||||
}
|
28
gcc/testsuite/g++.old-deja/g++.other/inline23.C
Normal file
28
gcc/testsuite/g++.old-deja/g++.other/inline23.C
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Build don't run:
|
||||
|
||||
struct B
|
||||
{
|
||||
virtual ~B() {}
|
||||
};
|
||||
|
||||
struct A : public B
|
||||
{
|
||||
~A();
|
||||
void foo(void);
|
||||
void bar(void);
|
||||
};
|
||||
|
||||
inline void A::foo(void)
|
||||
{
|
||||
static int i;
|
||||
i++;
|
||||
}
|
||||
|
||||
void A::bar()
|
||||
{
|
||||
foo();
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
16
gcc/testsuite/g++.old-deja/g++.other/local-alloc1.C
Normal file
16
gcc/testsuite/g++.old-deja/g++.other/local-alloc1.C
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Build don't link:
|
||||
// Origin: Jakub Jelinek <jakub@redhat.com>
|
||||
// Special g++ Options: -O0 -fpic
|
||||
|
||||
struct bar {
|
||||
bar() {}
|
||||
double x[3];
|
||||
};
|
||||
|
||||
static bar y[4];
|
||||
|
||||
void foo(int z)
|
||||
{
|
||||
bar w;
|
||||
y[z] = w;
|
||||
}
|
26
gcc/testsuite/g++.old-deja/g++.other/mangle10.C
Normal file
26
gcc/testsuite/g++.old-deja/g++.other/mangle10.C
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Build don't link:
|
||||
|
||||
template<int T>
|
||||
struct A {
|
||||
char *a;
|
||||
A (const char* x)
|
||||
{
|
||||
a = (char*) x;
|
||||
}
|
||||
};
|
||||
|
||||
template<int U, int V, class T>
|
||||
struct B {
|
||||
T a[V-U+1];
|
||||
friend A<V-U+1> f (B const &x)
|
||||
{
|
||||
return A<V-U+1> ((char*) x.a);
|
||||
}
|
||||
};
|
||||
|
||||
const int a = 8;
|
||||
|
||||
typedef B<1,a,int> C;
|
||||
struct D {
|
||||
C x;
|
||||
};
|
41
gcc/testsuite/g++.old-deja/g++.other/mangle11.C
Normal file
41
gcc/testsuite/g++.old-deja/g++.other/mangle11.C
Normal file
|
@ -0,0 +1,41 @@
|
|||
struct foo {
|
||||
static int bar ()
|
||||
{
|
||||
int i;
|
||||
static int baz = 1;
|
||||
{
|
||||
static int baz = 2;
|
||||
i = baz++;
|
||||
}
|
||||
{
|
||||
struct baz {
|
||||
static int m ()
|
||||
{
|
||||
static int n;
|
||||
return n += 10;
|
||||
}
|
||||
};
|
||||
baz a;
|
||||
i += a.m ();
|
||||
}
|
||||
{
|
||||
static int baz = 3;
|
||||
i += baz;
|
||||
baz += 30;
|
||||
}
|
||||
i += baz;
|
||||
baz += 60;
|
||||
return i;
|
||||
}
|
||||
};
|
||||
|
||||
int main ()
|
||||
{
|
||||
foo x;
|
||||
|
||||
if (x.bar () != 16)
|
||||
return 1;
|
||||
if (x.bar() != 117)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
46
gcc/testsuite/g++.old-deja/g++.other/reload1.C
Normal file
46
gcc/testsuite/g++.old-deja/g++.other/reload1.C
Normal file
|
@ -0,0 +1,46 @@
|
|||
extern "C" void abort ();
|
||||
|
||||
struct A {
|
||||
unsigned long long u;
|
||||
} *a;
|
||||
|
||||
struct B {
|
||||
unsigned long long v;
|
||||
unsigned long long w ()
|
||||
{
|
||||
return a->u - v;
|
||||
}
|
||||
} b;
|
||||
|
||||
struct C {
|
||||
static unsigned long long x;
|
||||
static void y (unsigned long long z);
|
||||
};
|
||||
|
||||
unsigned long long C::x = 0;
|
||||
|
||||
int main ()
|
||||
{
|
||||
a = new A;
|
||||
b.v = 333418;
|
||||
a->u = 1132270;
|
||||
C::x = 0;
|
||||
C::y (799016);
|
||||
}
|
||||
|
||||
void foo (unsigned long long a, unsigned long long b, unsigned long long c)
|
||||
{
|
||||
}
|
||||
|
||||
void C::y (unsigned long long z)
|
||||
{
|
||||
unsigned long long c = b.w () - x;
|
||||
if (z < b.w ())
|
||||
{
|
||||
if ((long long) c < 0)
|
||||
{
|
||||
foo (b.w (), a->u, b.v);
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
}
|
19
gcc/testsuite/g++.old-deja/g++.other/sibcall2.C
Normal file
19
gcc/testsuite/g++.old-deja/g++.other/sibcall2.C
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Build don't link:
|
||||
// Special g++ Options: -O2 -foptimize-sibling-calls -fno-exceptions
|
||||
|
||||
struct X
|
||||
{
|
||||
const char *c() const { return b; };
|
||||
char *b;
|
||||
};
|
||||
extern "C" int f (const char *);
|
||||
struct A
|
||||
{
|
||||
X x;
|
||||
void y();
|
||||
};
|
||||
void A::y()
|
||||
{
|
||||
const char *const a[] = { x.c() };
|
||||
f (a[0]);
|
||||
}
|
13
gcc/testsuite/g++.old-deja/g++.other/static20.C
Normal file
13
gcc/testsuite/g++.old-deja/g++.other/static20.C
Normal file
|
@ -0,0 +1,13 @@
|
|||
// Build don't run:
|
||||
struct foo
|
||||
{
|
||||
foo() {};
|
||||
~foo() {};
|
||||
void func() { static foo x; };
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
foo f;
|
||||
return 0;
|
||||
}
|
9
gcc/testsuite/g++.old-deja/g++.other/stmtexpr2.C
Normal file
9
gcc/testsuite/g++.old-deja/g++.other/stmtexpr2.C
Normal file
|
@ -0,0 +1,9 @@
|
|||
// Build don't link:
|
||||
// Special g++ Options: -O2
|
||||
// Origin: Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
void bar(int);
|
||||
void foo(int x)
|
||||
{
|
||||
bar(({ int y; y = x; }));
|
||||
}
|
87
gcc/testsuite/g++.old-deja/g++.other/store-expr1.C
Normal file
87
gcc/testsuite/g++.old-deja/g++.other/store-expr1.C
Normal file
|
@ -0,0 +1,87 @@
|
|||
// Skip if not target: i?86-*-*
|
||||
// Special g++ Options: -mcpu=i686 -O2 -fpic
|
||||
class G {};
|
||||
|
||||
struct N {
|
||||
N *a;
|
||||
};
|
||||
|
||||
struct V {
|
||||
typedef N *W;
|
||||
W *m, *n;
|
||||
int s() const { return int(n - m); }
|
||||
const W &operator[](int x) const { return *(m + x); }
|
||||
};
|
||||
|
||||
struct H;
|
||||
|
||||
struct J {
|
||||
N *c;
|
||||
H *d;
|
||||
J(N *x, H *y) : c(x), d(y) {}
|
||||
};
|
||||
|
||||
struct K {
|
||||
const N *c;
|
||||
const H *d;
|
||||
K(const N *x, const H *y) : c(x), d(y) {}
|
||||
K(const J &x) : c(x.c), d(x.d) {}
|
||||
};
|
||||
|
||||
struct H {
|
||||
V e;
|
||||
int f;
|
||||
|
||||
J u()
|
||||
{
|
||||
for (int x = 0; x < e.s(); ++x)
|
||||
if (e[x])
|
||||
return J(e[x], this);
|
||||
return v();
|
||||
}
|
||||
J v() { return J((N*)64, this); }
|
||||
};
|
||||
|
||||
struct I {
|
||||
H d;
|
||||
J u() { return d.u(); }
|
||||
J v() { return d.v(); }
|
||||
};
|
||||
|
||||
struct bar {
|
||||
virtual ~bar() {}
|
||||
};
|
||||
|
||||
struct E {
|
||||
K g;
|
||||
E(K x) : g(x) {}
|
||||
};
|
||||
|
||||
struct foo : public bar {
|
||||
K h;
|
||||
E i;
|
||||
foo(const K x, const E &y) : h(x), i(y) {}
|
||||
};
|
||||
|
||||
struct A {
|
||||
I *l;
|
||||
foo *baz() const;
|
||||
};
|
||||
|
||||
foo *A::baz() const
|
||||
{
|
||||
return new foo(l->u(), E(l->v()));
|
||||
}
|
||||
|
||||
A x;
|
||||
I i;
|
||||
foo *f;
|
||||
|
||||
int main ()
|
||||
{
|
||||
x.l = &i;
|
||||
f = x.baz();
|
||||
if (f->h.c != f->i.g.c || f->h.d != f->i.g.d)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
87
gcc/testsuite/g++.old-deja/g++.other/store-expr2.C
Normal file
87
gcc/testsuite/g++.old-deja/g++.other/store-expr2.C
Normal file
|
@ -0,0 +1,87 @@
|
|||
// Skip if not target: i?86-*-*
|
||||
// Special g++ Options: -mcpu=i686 -O2
|
||||
class G {};
|
||||
|
||||
struct N {
|
||||
N *a;
|
||||
};
|
||||
|
||||
struct V {
|
||||
typedef N *W;
|
||||
W *m, *n;
|
||||
int s() const { return int(n - m); }
|
||||
const W &operator[](int x) const { return *(m + x); }
|
||||
};
|
||||
|
||||
struct H;
|
||||
|
||||
struct J {
|
||||
N *c;
|
||||
H *d;
|
||||
J(N *x, H *y) : c(x), d(y) {}
|
||||
};
|
||||
|
||||
struct K {
|
||||
const N *c;
|
||||
const H *d;
|
||||
K(const N *x, const H *y) : c(x), d(y) {}
|
||||
K(const J &x) : c(x.c), d(x.d) {}
|
||||
};
|
||||
|
||||
struct H {
|
||||
V e;
|
||||
int f;
|
||||
|
||||
J u()
|
||||
{
|
||||
for (int x = 0; x < e.s(); ++x)
|
||||
if (e[x])
|
||||
return J(e[x], this);
|
||||
return v();
|
||||
}
|
||||
J v() { return J((N*)64, this); }
|
||||
};
|
||||
|
||||
struct I {
|
||||
H d;
|
||||
J u() { return d.u(); }
|
||||
J v() { return d.v(); }
|
||||
};
|
||||
|
||||
struct bar {
|
||||
virtual ~bar() {}
|
||||
};
|
||||
|
||||
struct E {
|
||||
K g;
|
||||
E(K x) : g(x) {}
|
||||
};
|
||||
|
||||
struct foo : public bar {
|
||||
K h;
|
||||
E i;
|
||||
foo(const K x, const E &y) : h(x), i(y) {}
|
||||
};
|
||||
|
||||
struct A {
|
||||
I *l;
|
||||
foo *baz() const;
|
||||
};
|
||||
|
||||
foo *A::baz() const
|
||||
{
|
||||
return new foo(l->u(), E(l->v()));
|
||||
}
|
||||
|
||||
A x;
|
||||
I i;
|
||||
foo *f;
|
||||
|
||||
int main ()
|
||||
{
|
||||
x.l = &i;
|
||||
f = x.baz();
|
||||
if (f->h.c != f->i.g.c || f->h.d != f->i.g.d)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
7
gcc/testsuite/g++.old-deja/g++.other/typename2.C
Normal file
7
gcc/testsuite/g++.old-deja/g++.other/typename2.C
Normal file
|
@ -0,0 +1,7 @@
|
|||
// Build don't link:
|
||||
|
||||
template<typename T>
|
||||
void f()
|
||||
{
|
||||
typename T::u; // ERROR - declare anything
|
||||
}
|
45
gcc/testsuite/g++.old-deja/g++.other/unchanging1.C
Normal file
45
gcc/testsuite/g++.old-deja/g++.other/unchanging1.C
Normal file
|
@ -0,0 +1,45 @@
|
|||
// Special g++ Options: -O2
|
||||
|
||||
#include <iostream>
|
||||
#include <complex>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class A {
|
||||
protected:
|
||||
int a;
|
||||
complex<double> *b;
|
||||
public:
|
||||
A(int n);
|
||||
inline complex<double>& operator[] (int x);
|
||||
};
|
||||
|
||||
A::A(int n)
|
||||
{
|
||||
a = n;
|
||||
b = new complex<double>[a];
|
||||
for (int i=0; i<a; i++) b[i] = complex<double>(0.0,0.0);
|
||||
}
|
||||
|
||||
inline complex<double>& A::operator[](int x)
|
||||
{
|
||||
if (x < 0 || x >= a)
|
||||
cout << "x error" << endl;
|
||||
return b[x];
|
||||
}
|
||||
|
||||
void foo ()
|
||||
{
|
||||
int n = 5;
|
||||
A *o = new A(n);
|
||||
A *p = new A(n);
|
||||
for (int i = 0; i < n; i++) {
|
||||
cout << i << endl;
|
||||
(*o)[i] *= complex<double>((*p)[i].real(), (*p)[i].imag());
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
foo();
|
||||
}
|
Loading…
Add table
Reference in a new issue