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

int main(int argc, char *argv[])
{
	char *c;
#ifdef FAIL
	const
#endif
		char *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