summaryrefslogtreecommitdiff
path: root/lib/ccan/cast/test/compile_fail-cast_static.c
blob: a4ebf61b1ae66549a792771ca1085701b9efce0b (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[])
{
	long c;
#ifdef FAIL
	char *
#else
	char
#endif
		x = 0;

	c = cast_static(long, x);
	(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 without compound literals"
#endif
#endif