Blaine Garst | 86d0ba4 | 2010-08-04 23:34:21 +0000 | [diff] [blame] | 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 | |
| 19 | int 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; |
| 31 | out_bad: |
| 32 | printf("%s: val not updated!\n", argv[0]); |
| 33 | return 1; |
| 34 | } |