1 // PR c++/13371 2 // Bug: We were failing to properly protect the lhs on the line marked 3 // "here" from multiple evaluation. 4 5 // { dg-do run } 6 7 extern "C" int printf (const char *, ...); 8 9 enum E { E1, E2 }; 10 11 struct A 12 { 13 E e : 8; 14 unsigned char c; 15 }; 16 17 A ar[2]; 18 19 int c; 20 f()21int f() 22 { 23 ++c; 24 printf ("f()\n"); 25 return 0; 26 } 27 main()28int main() 29 { 30 ar[0].c = 0xff; 31 ar[f()].e = E1; // here 32 return (c != 1 || ar[0].c != 0xff); 33 } 34