46 lines · plain
1// RUN: %clang_cc1 -emit-pch %s -o %t2// RUN: %clang_cc1 -include-pch %t -verify %s3 4#ifndef HEADER_INCLUDED5 6#define HEADER_INCLUDED7 8@protocol NSObject9@end10 11__attribute__((objc_root_class))12@interface NSObject13@end14 15@interface PC1<__covariant T, U : NSObject *> : NSObject16// expected-note@-2{{type parameter 'U' declared here}}17@end18 19@interface PC1<__covariant T, U : NSObject *> (Cat1)20@end21 22typedef PC1<id, NSObject *> PC1Specialization1;23 24typedef PC1Specialization1 <NSObject> PC1Specialization2;25#else26 27@interface PC1<T : NSObject *, // expected-error{{type bound 'NSObject *' for type parameter 'T' conflicts with implicit bound 'id}}28 // expected-note@15{{type parameter 'T' declared here}}29 U : id> (Cat2) // expected-error{{type bound 'id' for type parameter 'U' conflicts with previous bound 'NSObject *'}}30 // expected-note@15{{type parameter 'U' declared here}}31@end32 33typedef PC1Specialization1<id, NSObject *> PC1Specialization3; // expected-error{{type arguments cannot be applied to already-specialized class type 'PC1Specialization1' (aka 'PC1<id,NSObject *>')}}34 35typedef PC1Specialization2<id, NSObject *> PC1Specialization4; // expected-error{{already-specialized class type 'PC1Specialization2' (aka 'PC1Specialization1<NSObject>')}}36 37@interface NSString : NSObject38@end39 40void testCovariance(PC1<NSObject *, NSObject *> *pc1a,41 PC1<NSString *, NSObject *> *pc1b) {42 pc1a = pc1b;43}44 45#endif46