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