xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/block-labels.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -verify -fblocks -fsyntax-only
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc void xx();
4*f4a2713aSLionel Sambuc 
a()5*f4a2713aSLionel Sambuc int a() {
6*f4a2713aSLionel Sambuc   A:
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc   if (1) xx();
9*f4a2713aSLionel Sambuc   return ^{
10*f4a2713aSLionel Sambuc          A: return 1;
11*f4a2713aSLionel Sambuc        }();
12*f4a2713aSLionel Sambuc }
b()13*f4a2713aSLionel Sambuc int b() {
14*f4a2713aSLionel Sambuc   A: return ^{int a; A:return 1;}();
15*f4a2713aSLionel Sambuc }
16*f4a2713aSLionel Sambuc 
d()17*f4a2713aSLionel Sambuc int d() {
18*f4a2713aSLionel Sambuc   A: return ^{int a; A: a = ^{int a; A:return 1;}() + ^{int b; A:return 2;}(); return a; }();
19*f4a2713aSLionel Sambuc }
20*f4a2713aSLionel Sambuc 
c()21*f4a2713aSLionel Sambuc int c() {
22*f4a2713aSLionel Sambuc   goto A;     // expected-error {{use of undeclared label 'A'}}
23*f4a2713aSLionel Sambuc   return ^{
24*f4a2713aSLionel Sambuc        A:
25*f4a2713aSLionel Sambuc         return 1;
26*f4a2713aSLionel Sambuc      }();
27*f4a2713aSLionel Sambuc }
28