summaryrefslogtreecommitdiff
path: root/test/BlocksRuntime/goto.c
blob: 7e5b08adbe8e251b7bf7744dd50faf80c3bdcee9 (plain)
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
29
30
31
32
33
34
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.

/*
 *  goto.c
 *  testObjects
 *
 *  Created by Blaine Garst on 10/17/08.
 *
 */
 
// CONFIG rdar://6289031

#include <stdio.h>

int main(int argc, char *argv[])
{
	__block int val = 0;

	^{ val = 1; }();

	if (val == 0) {
		goto out_bad; // error: local byref variable val is in the scope of this goto
	}

        printf("%s: Success!\n", argv[0]);
	return 0;
out_bad:
        printf("%s: val not updated!\n", argv[0]);
	return 1;
}