2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.other / optimize1.C
blobb4707c5af60954122814095e6e298fa83faccd94
1 // { dg-do run  }
2 // { dg-options "-O2" }
3 // 
4 // Copyright (C) 2001 Free Software Foundation, Inc.
5 // Contributed by Nathan Sidwell 18 May 2001 <nathan@codesourcery.com>
7 // Bug 2781. We forgot to copy addressability information when
8 // cloning.
10 struct B
12   B(int v1);
13   void Member (int v1);
14   static void Static (int v1);
17 struct D : B
19   D (int v1);
22 void xswap(int& x1) ;
24 int xxx = 0;
26 B::B(int v1) 
28   xswap(v1);
29   xxx = v1;
32 void B::Member(int v1) 
34   xswap(v1);
35   xxx = v1;
38 void B::Static(int v1) 
40   xswap(v1);
41   xxx = v1;
44 D::D(int v1)
45   : B (v1)
49 void xswap (int& x1) { x1 = 2; }
51 int main ()
53   B p (1);
55   if (xxx != 2)
56     return 1;
58   D q (1);
59   if (xxx != 2)
60     return 2;
61   
62   p.Member (1);
63   if (xxx != 2)
64     return 3;
66   p.Static (1);
67   if (xxx != 2)
68     return 4;
70   return 0;