Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaCXX / composite-pointer-type.cpp
blobdddf424caa2e98c79b60e5e5570dfc0983d56b43
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 class Base { };
4 class Derived1 : public Base { };
5 class Derived2 : public Base { };
7 void f0(volatile Base *b, Derived1 *d1, const Derived2 *d2) {
8 if (b > d1)
9 return;
10 if (d1 <= b)
11 return;
12 if (b > d2)
13 return;
14 if (d1 >= d2) // expected-error{{comparison of distinct}}
15 return;
18 void f1(volatile Base *b, Derived1 *d1, const Derived2 *d2) {
19 if (b == d1)
20 return;
21 if (d1 == b)
22 return;
23 if (b != d2)
24 return;
25 if (d1 == d2) // expected-error{{comparison of distinct}}
26 return;
29 // PR4691
30 int ptrcmp1(void *a, int *b) {
31 return a < b;
33 int ptrcmp2(long *a, int *b) {
34 return a < b; // expected-error{{distinct}}
37 // PR5509 - Multi-level pointers
38 int f2() {
39 typedef int *IntPtr;
40 typedef IntPtr *IntPtrPtr;
41 typedef IntPtr const *IntPtrConstPtr;
42 IntPtrConstPtr i = 0;
43 IntPtrPtr j = 0;
44 return i != j;
47 // PR5763
48 typedef double Matrix4[4][4];
50 bool f(Matrix4 m1, const Matrix4 m2) {
51 return m1 != m2;
54 // PR6346
55 bool f1(bool b, void **p, const void **q) {
56 if (p == q)
57 return false;
59 return b? p : q;