aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/nullptr22.C
blob: 13cb8e3aab1e8a00e02639f0ee24795a9c347c91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// { dg-do compile }
// { dg-options "-std=c++0x -Wall -Wformat=2 -Wstrict-null-sentinel" }

// Test various warnings

void f1(const char*, ...) __attribute__((format(printf, 1, 2)));
void f2(const char*) __attribute__((nonnull));
void f3(const char*, ...) __attribute__((sentinel));

void f()
{
  f1("%p", nullptr);
  f2(nullptr); // { dg-warning "null argument where non-null required " }
  f3("x", "y", __null); // { dg-warning "missing sentinel in function call" }
  f3("x", "y", nullptr);
}