gcc/testsuite/g++.dg/warn/Wnonnull3.C
raw| 1 | // PR c++/79962 |
| 2 | // { dg-options "-Wnonnull" } |
| 3 | |
| 4 | template <class T> |
| 5 | __attribute__ ((__nonnull__ (T::i))) void f (typename T::U) { } |
| 6 | |
| 7 | struct S1 { enum { i = 1 }; typedef void* U; }; |
| 8 | struct S2 { static const int i = 1; typedef void* U; }; |
| 9 | |
| 10 | void |
| 11 | g () |
| 12 | { |
| 13 | f<S1>(0); // { dg-warning "argument 1 null where non-null expected" } |
| 14 | f<S2>(0); // { dg-warning "argument 1 null where non-null expected" } |
| 15 | } |