repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
PR c++/85963 - -Wunused-but-set with ?: in template.
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
warn
/
Wunused-var-34.C
blob
52c715121f5fa100a2877923a17e4e7193551bb3
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