OSDN Git Service

/cp
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.other / optimize3.C
1 // { dg-do run  }
2 // { dg-options "-O2" }
3 // 
4 // Copyright (C) 2001 Free Software Foundation, Inc.
5 // Contributed by Nathan Sidwell 29 May 2001 <nathan@codesourcery.com>
6
7 // Bug 2936. We ICE'd on tree inlining a function with an anonymous
8 // union decl.
9
10 inline const unsigned char *Foo (const char *string)
11 {
12   union
13   {
14     const char *p1;
15     const unsigned char *p2;
16   };
17   p1 = 0;
18   p2 = 0;
19
20
21   p1 = string;
22   return p2;
23   
24 }
25
26 const unsigned char *Baz (const char *string)
27 {
28   return Foo (string);
29 }
30
31 int main ()
32 {
33   const char *string = "s";
34   const unsigned char *result;
35
36   result = Baz (string);
37   return (static_cast <const void *> (result)
38           != static_cast <const void *> (string));
39 }