Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaCXX / compare-function-pointer.cpp
blob0b185ce08f917a25ebd8fc2184596f3eec9634b7
1 // RUN: %clang_cc1 -fsyntax-only -std=c++20 -verify %s
3 using fp0_t = void (*)();
4 using fp1_t = int (*)();
6 extern fp0_t a, b;
7 extern fp1_t c;
9 bool eq0 = a == b;
10 bool ne0 = a != b;
11 bool lt0 = a < b; // expected-warning {{ordered comparison of function pointers ('fp0_t' (aka 'void (*)()') and 'fp0_t')}}
12 bool le0 = a <= b; // expected-warning {{ordered comparison of function pointers}}
13 bool gt0 = a > b; // expected-warning {{ordered comparison of function pointers}}
14 bool ge0 = a >= b; // expected-warning {{ordered comparison of function pointers}}
15 auto tw0 = a <=> b; // expected-error {{ordered comparison of function pointers}}
17 bool eq1 = a == c; // expected-error {{comparison of distinct pointer types}}
18 bool ne1 = a != c; // expected-error {{comparison of distinct pointer types}}
19 bool lt1 = a < c; // expected-warning {{ordered comparison of function pointers ('fp0_t' (aka 'void (*)()') and 'fp1_t' (aka 'int (*)()'))}}
20 // expected-error@-1 {{comparison of distinct pointer types}}
21 bool le1 = a <= c; // expected-warning {{ordered comparison of function pointers}}
22 // expected-error@-1 {{comparison of distinct pointer types}}
23 bool gt1 = a > c; // expected-warning {{ordered comparison of function pointers}}
24 // expected-error@-1 {{comparison of distinct pointer types}}
25 bool ge1 = a >= c; // expected-warning {{ordered comparison of function pointers}}
26 // expected-error@-1 {{comparison of distinct pointer types}}
27 auto tw1 = a <=> c; // expected-error {{ordered comparison of function pointers}}