1 /* { dg-do compile } */ 2 /* { dg-options "-Wunused" } */ 3 4 struct S { int e; }; 5 6 int f1(void)7f1 (void) 8 { 9 int a; 10 int b; 11 int c; 12 int d; 13 S s; 14 a = 1; 15 b = 2; 16 c = 3; 17 d = 4; 18 s.e = 5; 19 __typeof (c) e; // { dg-warning "set but not used" } 20 __decltype (d) f; // { dg-warning "set but not used" } 21 __decltype (s.e) g; // { dg-warning "set but not used" } 22 e = 1; 23 f = 1; 24 g = 1; 25 return sizeof (a) + __alignof__ (b); 26 } 27 28 template <int N> f2(void)29int f2 (void) 30 { 31 int a; 32 int b; 33 int c; 34 int d; 35 a = 1; 36 b = 2; 37 c = 3; 38 d = 4; 39 __typeof (c) e; // { dg-warning "set but not used" } 40 __decltype (d) f; // { dg-warning "set but not used" } 41 e = 1; 42 f = 1; 43 return sizeof (a) + __alignof__ (b); 44 } 45 46 void test(void)47test (void) 48 { 49 (void) f2<0> (); 50 } 51