gcc/testsuite/g++.dg/warn/Wunused-var-34.C
raw| 1 | // PR c++/85963 |
| 2 | // { dg-additional-options -Wall } |
| 3 | |
| 4 | template<typename T> |
| 5 | struct foo { |
| 6 | T val, alpha; |
| 7 | foo() : val(0), alpha(0) {} |
| 8 | }; |
| 9 | |
| 10 | template<typename T> |
| 11 | inline void bar(const foo<T>& A, const foo<T>& B, foo<T>& C) { |
| 12 | const bool use_alpha = true; |
| 13 | const T alpha = use_alpha ? (A.alpha * B.alpha) : T(0); |
| 14 | |
| 15 | C.val = A.val * B.val; |
| 16 | C.alpha = alpha; |
| 17 | } |
| 18 | |
| 19 | |
| 20 | int main() { |
| 21 | foo<double> A,B,C; |
| 22 | |
| 23 | bar(A,B,C); |
| 24 | |
| 25 | return 0; |
| 26 | } |
| 27 |