goto.c revision 2d1fdb26e458c4ddc04155c1d421bced3ba90cd0
1// 2// The LLVM Compiler Infrastructure 3// 4// This file is distributed under the University of Illinois Open Source 5// License. See LICENSE.TXT for details. 6 7/* 8 * goto.c 9 * testObjects 10 * 11 * Created by Blaine Garst on 10/17/08. 12 * 13 */ 14 15// CONFIG rdar://6289031 16 17#include <stdio.h> 18 19int main(int argc, char *argv[]) 20{ 21 __block int val = 0; 22 23 ^{ val = 1; }(); 24 25 if (val == 0) { 26 goto out_bad; // error: local byref variable val is in the scope of this goto 27 } 28 29 printf("%s: Success!\n", argv[0]); 30 return 0; 31out_bad: 32 printf("%s: val not updated!\n", argv[0]); 33 return 1; 34} 35