gcc/testsuite/g++.dg/warn/Wtautological-compare4.C
raw| 1 | // PR c++/116534 |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-Wall" } |
| 4 | |
| 5 | template <class A> |
| 6 | struct Test { |
| 7 | bool foo(unsigned x, unsigned y) { |
| 8 | bool test = &a[x] == &b[y]; |
| 9 | return test; |
| 10 | } |
| 11 | unsigned *a; |
| 12 | unsigned *b; |
| 13 | }; |
| 14 | |
| 15 | void |
| 16 | g () |
| 17 | { |
| 18 | Test<int> t; |
| 19 | t.foo (0u, 1u); |
| 20 | t.foo (0u, 0u); |
| 21 | } |