aboutsummaryrefslogtreecommitdiff
path: root/tests/defer_shadow/defer_shadow.ek
blob: 0e890a2edc6434d8d7459503d14ee480adaa6c02 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
typedef i9 {}
typedef i27 {}

define any[] {}

extern _putchar(i9 c);

typedef some_struct[any T] {
	test()
	{
		i9 a = 'a' as i9;
		{
			/* at this point, only a is defined */
			defer _putchar(a);

			/* a gets shadowed */
			i9 a = 'b' as i9;

			/* defer should still point to the outer 'a' */
		}
	}
}

main()
{
	some_struct![i9] test = some_struct![i9]{};
	test.test();
}