summaryrefslogtreecommitdiff
path: root/test/Sema/block-explicit-noreturn-type.c
blob: 12f4f4f3401fc820ef73eaa0dda481cb3ba1cd36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks
// rdar://10466373

typedef short SHORT;

void f0() {
  (void) ^{
    if (1)
      return (float)1.0;
    else if (2)
      return (double)2.0; // expected-error {{return type 'double' must match previous return type 'float' when block literal has}}
    else
      return (SHORT)3; // expected-error {{return type 'SHORT' (aka 'short') must match previous return type 'float' when}}
  };
}