summaryrefslogtreecommitdiff
path: root/clang/test/SemaObjC/compare-qualified-class.m
blob: 0f415b607dd72c08e3238c9b3f3af38d9b24c5b8 (about) (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
26
27
28
29
30
// RUN: %clang_cc1 -fsyntax-only -verify %s
// rdar://8191774

@protocol SomeProtocol
@end

@protocol SomeProtocol1
@end

@interface SomeObject <SomeProtocol>
@end

int main () {
    Class <SomeProtocol> classA;
    Class <SomeProtocol> classB;
    Class <SomeProtocol, SomeProtocol1> classC;
    Class <SomeProtocol1> classD;
    void * pv = 0;
    Class c = (Class)0;;
    if (pv)
      return classA == pv;

    if (c)
      return classA == c;
    
    return classA == classB  || classA == classC ||
           classC == classA ||
           classA == classD; // expected-warning {{comparison of distinct pointer types ('Class<SomeProtocol> *' and 'Class<SomeProtocol1> *')}}
}