1 | // RUN: %clang_cc1 -fsyntax-only -x objective-c++ -verify -Wno-objc-root-class %s |
2 | // rdar://15499111 |
3 | typedef struct __attribute__((objc_bridge_related(NSColor,colorWithCGColor:,CGColor))) CGColor *CGColorRef; // expected-note 6 {{declared here}} |
4 | |
5 | @interface NSColor // expected-note 6 {{declared here}} |
6 | + (NSColor *)colorWithCGColor:(CGColorRef)cgColor; |
7 | - (CGColorRef)CGColor; |
8 | @end |
9 | |
10 | @interface NSTextField |
11 | - (void)setBackgroundColor:(NSColor *)color; |
12 | - (NSColor *)backgroundColor; |
13 | @end |
14 | |
15 | |
16 | NSColor *Test1(NSColor *nsColor, CGColorRef newColor) { |
17 | nsColor = newColor; // expected-error {{'CGColorRef' (aka 'CGColor *') must be explicitly converted to 'NSColor *'; use '+colorWithCGColor:' method for this conversion}} |
18 | NSColor *ns = newColor; // expected-error {{'CGColorRef' (aka 'CGColor *') must be explicitly converted to 'NSColor *'; use '+colorWithCGColor:' method for this conversion}} |
19 | return newColor; // expected-error {{'CGColorRef' (aka 'CGColor *') must be explicitly converted to 'NSColor *'; use '+colorWithCGColor:' method for this conversion}} |
20 | } |
21 | |
22 | CGColorRef Test2(NSColor *newColor, CGColorRef cgColor) { |
23 | cgColor = newColor; // expected-error {{'NSColor *' must be explicitly converted to 'CGColorRef' (aka 'CGColor *'); use '-CGColor' method for this conversion}} |
24 | CGColorRef cg = newColor; // expected-error {{'NSColor *' must be explicitly converted to 'CGColorRef' (aka 'CGColor *'); use '-CGColor' method for this conversion}} |
25 | return newColor; // expected-error {{'NSColor *' must be explicitly converted to 'CGColorRef' (aka 'CGColor *'); use '-CGColor' method for this conversion}} |
26 | } |
27 | |
28 | |