aboutsummaryrefslogtreecommitdiff
path: root/test/ARCMT/nonobjc-to-objc-cast-2.m
blob: 46ef02400e8cb2f773263053472dc008138d1b80 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi %s

typedef int BOOL;
typedef const struct __CFString * CFStringRef;

@class NSString;

void f(BOOL b) {
  CFStringRef cfstr;
  NSString *str = (NSString *)cfstr; // expected-error {{cast of C pointer type 'CFStringRef' (aka 'const struct __CFString *') to Objective-C pointer type 'NSString *' requires a bridged cast}} \
    // expected-note{{use __bridge to convert directly (no change in ownership)}} \
    // expected-note{{use __bridge_transfer to transfer ownership of a +1 'CFStringRef' (aka 'const struct __CFString *') into ARC}}
  void *vp = str;  // expected-error {{disallowed}}
}