summaryrefslogtreecommitdiff
path: root/ccan/foreach/test/compile_ok-const.c
blob: d1c858a0fb6e087f6f10f0c23dd3a514d3b2bc24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <ccan/foreach/foreach.h>
#include <ccan/foreach/foreach.c>

/* Iterating over const pointers should work fine. */
int main(int argc, char *argv[])
{
	const char *s1 = "hello", *s2 = "world", *p;
	unsigned int i = 0;

	foreach_ptr(p, s1, s2)
		i++;

	return i == 2 ? 0 : 1;
}