Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wunused-var-12.C

raw
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;
9 S (const int &a, const int &b) : u(a), v(b) { }
10 };
11
12 bool
13 f1 ()
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
23 f2 ()
24 {
25 S z = S (1, 2);
26 z.u; // { dg-warning "no effect" }
27 }
28
29 int i;
30
31 void
32 f3 ()
33 {
34 S z = S (1, 2);
35 i++, z.u; // { dg-warning "no effect" }
36 }