aboutsummaryrefslogtreecommitdiff
path: root/ccan/str/test/compile_fail-STR_MAX_CHARS.c
blob: 74448c1b81af19024612331de56e3c4ff30b220a (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/str/str.h>

struct s {
	int val;
};

int main(int argc, char *argv[])
{
	struct s
#ifdef FAIL
#if !HAVE_TYPEOF
	#error We need typeof to check STR_MAX_CHARS.
#endif
#else
	/* A pointer is OK. */
		*
#endif
		val;
	char str[STR_MAX_CHARS(val)];

	str[0] = '\0';
	return str[0] ? 0 : 1;
}