1 /* { dg-do compile } */ 2 /* { dg-options "-g" } */ 3 /* { dg-skip-if "" { { hppa*-*-hpux* *-*-solaris2.[56]* powerpc-ibm-aix* } && { ! hppa*64*-*-* } } { "*" } { "" } } */ 4 5 /* Make sure we didn't eliminate casted types because we thought they were 6 unused. */ 7 8 void *voidp; 9 10 struct foo { int i; }; bar(void)11int bar (void) 12 { 13 return ((struct foo *)0x1234)->i; 14 } 15 16 struct boo { int i; }; bar2(void)17int bar2 (void) 18 { 19 return reinterpret_cast<struct boo *>(0xC0FFEE)->i; 20 } 21 22 struct cue { int i; }; bar3(void)23int bar3 (void) 24 { 25 return static_cast<struct cue *>(voidp)->i; 26 } 27 28 class printer { public: int i; }; 29 const printer *dotmatrix; bar4(void)30int bar4 (void) 31 { 32 return const_cast<printer *>(dotmatrix)->i; 33 } 34 35 class class1 { public: virtual ~class1(); } *c1; 36 class class2 : class1 { char j; }; bar5(void)37int bar5 (void) 38 { 39 if (dynamic_cast <class2 *>(c1)) 40 return 5; 41 else 42 return 6; 43 } 44 /* { dg-final { scan-assembler "foo" } } */ 45 /* { dg-final { scan-assembler "boo" } } */ 46 /* { dg-final { scan-assembler "cue" } } */ 47 /* The xfail below is for PR33429. */ 48 /* { dg-final { scan-assembler "(string|ascii?)z?\[\t \]\"class2(\"|\\\\0)" { xfail *-*-* } } } */ 49 /* { dg-final { scan-assembler "(string|ascii?)z?\[\t \]\"printer(\"|\\\\0)" } } */ 50