summaryrefslogtreecommitdiff
path: root/test/SemaObjCXX/is-base-of.mm
blob: 9cf16661b0c580ea1125c7a77e58d73b87f7b25b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s

@interface NSObj
@end

@interface NSChild : NSObj
@end

static_assert(__is_base_of(NSObj, NSChild), "");
static_assert(!__is_base_of(NSChild, NSObj), "");

static_assert(__is_base_of(NSObj, NSObj), "");

static_assert(!__is_base_of(NSObj *, NSChild *), "");
static_assert(!__is_base_of(NSChild *, NSObj *), "");

static_assert(__is_base_of(const volatile NSObj, NSChild), "");
static_assert(__is_base_of(NSObj, const volatile NSChild), "");

@class NSForward; // expected-note{{forward declaration of class}}

static_assert(!__is_base_of(NSForward, NSObj), "");
static_assert(!__is_base_of(NSObj, NSForward), ""); // expected-error{{incomplete type 'NSForward'}}

static_assert(!__is_base_of(id, NSObj), "");