summaryrefslogtreecommitdiff
path: root/lib/ccan/cast/test/compile_fail-cast_static-2.c
blob: 8a1202538455ecc4a30b96bd352f843e1d6c07d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <ccan/cast/cast.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
	char *c;
#ifdef FAIL
	long
#else
	char
#endif
		*p = 0;

	c = cast_static(char *, p);
	(void) c; /* Suppress unused-but-set-variable warning. */
	return 0;
}

#ifdef FAIL
#if !HAVE_COMPOUND_LITERALS
#error "Unfortunately we don't fail if cast_static is a noop"
#endif
#endif