// RUN: %clang_cc1 -fblocks -fsyntax-only %s -verify -Wmethod-signatures
// Tests Objective-C 'kindof' types.
// ---------------------------------------------------------------------------
// Parsing and semantic analysis for __kindof
// ---------------------------------------------------------------------------
// Test proper application of __kindof.
typedef __kindof NSObject *typedef1;
typedef NSObject __kindof *typedef2;
typedef __kindof NSObject<NSCopying> typedef3;
typedef NSObject<NSCopying> __kindof *typedef4;
typedef __kindof typedef5;
typedef __kindof Class<NSCopying> typedef6;
// Test redundancy of __kindof.
typedef __kindof id __kindof redundant_typedef1;
typedef __kindof NSObject __kindof *redundant_typedef2;
// Test application of __kindof to typedefs.
typedef NSObject *NSObject_ptr_typedef;
typedef NSObject NSObject_typedef;
typedef __kindof NSObject_ptr_typedef typedef_typedef1;
typedef __kindof NSObject_typedef typedef_typedef2;
// Test application of __kindof to non-object types.
typedef __kindof int nonobject_typedef1; // expected-error{{'__kindof' specifier cannot be applied to non-object type 'int'}}
typedef NSObject **NSObject_ptr_ptr;
typedef __kindof NSObject_ptr_ptr nonobject_typedef2; // expected-error{{'__kindof' specifier cannot be applied to non-object type 'NSObject_ptr_ptr' (aka 'NSObject **')}}
// Test application of __kindof outside of the decl-specifiers.
typedef NSObject * __kindof bad_specifier_location1; // expected-error{{'__kindof' type specifier must precede the declarator}}
typedef NSObject bad_specifier_location2 __kindof; // expected-error{{expected ';' after top level declarator}}
// expected-warning@-1{{declaration does not declare anything}}
// ---------------------------------------------------------------------------
// Pretty printing of __kindof
// ---------------------------------------------------------------------------
void
// ---------------------------------------------------------------------------
// Basic implicit conversions (dropping __kindof, upcasts, etc.)
// ---------------------------------------------------------------------------
void
void
void
// ---------------------------------------------------------------------------
// Implicit downcasting
// ---------------------------------------------------------------------------
void
void
typedef signed char BOOL;
void
// ---------------------------------------------------------------------------
// Blocks
// ---------------------------------------------------------------------------
void
// ---------------------------------------------------------------------------
// Messaging __kindof types.
// ---------------------------------------------------------------------------
void
void
void
// Make sure we don't emit warning about multiple methods found.
typedef int NSInteger;
void
// Make sure we don't emit warning about no method found.
void
typedef const struct CGPath *CGPathRef;
// Make sure we choose "NSString *path" for [s1 path].
void
// ---------------------------------------------------------------------------
// __kindof within specialized types
// ---------------------------------------------------------------------------
void
// ---------------------------------------------------------------------------
// __kindof + nullability
// ---------------------------------------------------------------------------
void
// Make sure that we don't emit a warning about conflicting parameter types
// between __kindof id and id.
// ---------------------------------------------------------------------------
// __kindof on type parameters
// ---------------------------------------------------------------------------
void
void
void
void
// Check that clang doesn't crash when a type parameter is illegal.