1 // PR c++/44444 2 // { dg-do compile } 3 // { dg-options "-Wunused" } 4 5 struct S 6 { 7 const int &u; 8 const int &v; SS9 S (const int &a, const int &b) : u(a), v(b) { } 10 }; 11 12 bool f1()13f1 () 14 { 15 bool t = false; 16 S z = S (1, 2); 17 t |= z.u == 1; 18 t |= z.v == 2; 19 return t; 20 } 21 22 void f2()23f2 () 24 { 25 S z = S (1, 2); 26 z.u; // { dg-warning "no effect" } 27 } 28 29 int i; 30 31 void f3()32f3 () 33 { 34 S z = S (1, 2); 35 i++, z.u; // { dg-warning "no effect" } 36 } 37