185f3f951SDouglas Gregor// RUN: %clang_cc1 -emit-pch %s -o %t 285f3f951SDouglas Gregor// RUN: %clang_cc1 -include-pch %t -verify %s 385f3f951SDouglas Gregor 485f3f951SDouglas Gregor#ifndef HEADER_INCLUDED 585f3f951SDouglas Gregor 685f3f951SDouglas Gregor#define HEADER_INCLUDED 785f3f951SDouglas Gregor 885f3f951SDouglas Gregor@protocol NSObject 985f3f951SDouglas Gregor@end 1085f3f951SDouglas Gregor 1185f3f951SDouglas Gregor__attribute__((objc_root_class)) 1285f3f951SDouglas Gregor@interface NSObject 1385f3f951SDouglas Gregor@end 1485f3f951SDouglas Gregor 15*1ac1b63cSDouglas Gregor@interface PC1<__covariant T, U : NSObject *> : NSObject 1685f3f951SDouglas Gregor// expected-note@-2{{type parameter 'U' declared here}} 1785f3f951SDouglas Gregor@end 1885f3f951SDouglas Gregor 19*1ac1b63cSDouglas Gregor@interface PC1<__covariant T, U : NSObject *> (Cat1) 2085f3f951SDouglas Gregor@end 2185f3f951SDouglas Gregor 22e9d95f1eSDouglas Gregortypedef PC1<id, NSObject *> PC1Specialization1; 23e9d95f1eSDouglas Gregor 24e83b9564SDouglas Gregortypedef PC1Specialization1 <NSObject> PC1Specialization2; 2585f3f951SDouglas Gregor#else 2685f3f951SDouglas Gregor 2785f3f951SDouglas Gregor@interface PC1<T : NSObject *, // expected-error{{type bound 'NSObject *' for type parameter 'T' conflicts with implicit bound 'id}} 2885f3f951SDouglas Gregor // expected-note@15{{type parameter 'T' declared here}} 2985f3f951SDouglas Gregor U : id> (Cat2) // expected-error{{type bound 'id' for type parameter 'U' conflicts with previous bound 'NSObject *'}} 3085f3f951SDouglas Gregor // expected-note@15{{type parameter 'U' declared here}} 3185f3f951SDouglas Gregor@end 3285f3f951SDouglas Gregor 33e83b9564SDouglas Gregortypedef PC1Specialization1<id, NSObject *> PC1Specialization3; // expected-error{{type arguments cannot be applied to already-specialized class type 'PC1Specialization1' (aka 'PC1<id,NSObject *>')}} 34e83b9564SDouglas Gregor 35e83b9564SDouglas Gregortypedef PC1Specialization2<id, NSObject *> PC1Specialization4; // expected-error{{already-specialized class type 'PC1Specialization2' (aka 'PC1Specialization1<NSObject>')}} 36e9d95f1eSDouglas Gregor 37*1ac1b63cSDouglas Gregor@interface NSString : NSObject 38*1ac1b63cSDouglas Gregor@end 39*1ac1b63cSDouglas Gregor 40*1ac1b63cSDouglas Gregorvoid testCovariance(PC1<NSObject *, NSObject *> *pc1a, 41*1ac1b63cSDouglas Gregor PC1<NSString *, NSObject *> *pc1b) { 42*1ac1b63cSDouglas Gregor pc1a = pc1b; 43*1ac1b63cSDouglas Gregor} 44*1ac1b63cSDouglas Gregor 4585f3f951SDouglas Gregor#endif 46