]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/g++.dg/cpp0x/nullptr22.C
Underline argument in -Wnonnull and in C++ extend warning to the this pointer [PR...
[thirdparty/gcc.git] / gcc / testsuite / g++.dg / cpp0x / nullptr22.C
CommitLineData
4b2e63de
JM
1// { dg-do compile { target c++11 } }
2// { dg-options "-Wall -Wformat=2 -Wstrict-null-sentinel" }
14c2101d
JM
3
4// Test various warnings
5
6void f1(const char*, ...) __attribute__((format(printf, 1, 2)));
7void f2(const char*) __attribute__((nonnull));
8void f3(const char*, ...) __attribute__((sentinel));
9
10void f()
11{
12 f1("%p", nullptr);
75ff24e1 13 f2(nullptr); // { dg-warning "argument 1 null where non-null expected " }
14c2101d
JM
14 f3("x", "y", __null); // { dg-warning "missing sentinel in function call" }
15 f3("x", "y", nullptr);
33c2474d
MF
16 decltype(nullptr) mynull = 0;
17 f1("%p", mynull);
75ff24e1 18 f2(mynull); // { dg-warning "argument 1 null where non-null expected " }
33c2474d 19 f3("x", "y", mynull);
14c2101d 20}