summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/warn/format4.C
blob: fa622fceb4f9528ff14f9a9ddcb0a9decb06ca7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// { dg-do compile }
// { dg-options "-Wformat=2" }

extern "C" int printf (const char*, ...);

void foo(int i)
{
	printf("Hello World %d!\n", i);
	printf(&"Hello World %d!\n"[0], i);
	printf(&"Hello World %d!\n"[6], i);
	printf(&"Hello World %d!\n"[8]-2, i);
	printf(&"Hello World %d!\n"[4]+2, i);
}