1 // RUN: %clang_cc1 -verify %s -std=c++17 -Weverything -Wno-deprecated -Wno-float-equal
2 // RUN: %clang_cc1 -verify %s -std=c++2a -Wdeprecated
4 static enum E1
{} e1
, e1b
;
12 void(e1
* e2
); // expected-warning {{arithmetic between different enumeration types}}
13 void(e1
* d
); // expected-warning {{arithmetic between enumeration type 'enum E1' and floating-point type 'double'}}
14 void(d
* e1
); // expected-warning {{arithmetic between floating-point type 'double' and enumeration type 'enum E1'}}
17 void(e1
+ e2
); // expected-warning {{arithmetic between different enumeration types}}
18 void(e1
+ d
); // expected-warning {{arithmetic between enumeration type 'enum E1' and floating-point type 'double'}}
19 void(d
+ e1
); // expected-warning {{arithmetic between floating-point type 'double' and enumeration type 'enum E1'}}
21 #if __cplusplus > 201703L
22 void(e1
<=> e1b
); // expected-error {{include <compare>}}
23 void(e1
<=> e2
); // expected-error {{invalid operands}}
24 void(e1
<=> d
); // expected-error {{invalid operands}}
25 void(d
<=> e1
); // expected-error {{invalid operands}}
29 void(e1
< e2
); // expected-warning {{comparison of different enumeration types}}
30 void(e1
< d
); // expected-warning {{comparison of enumeration type 'enum E1' with floating-point type 'double'}}
31 void(d
< e1
); // expected-warning {{comparison of floating-point type 'double' with enumeration type 'enum E1'}}
34 void(e1
== e2
); // expected-warning {{comparison of different enumeration types}}
35 void(e1
== d
); // expected-warning {{comparison of enumeration type 'enum E1' with floating-point type 'double'}}
36 void(d
== e1
); // expected-warning {{comparison of floating-point type 'double' with enumeration type 'enum E1'}}
39 void(b
? e1
: e2
); // expected-warning {{conditional expression between different enumeration types}}
40 void(b
? e1
: d
); // expected-warning {{conditional expression between enumeration type 'enum E1' and floating-point type 'double'}}
41 void(b
? d
: e1
); // expected-warning {{conditional expression between floating-point type 'double' and enumeration type 'enum E1'}}
44 void(e1
= e2
); // expected-error {{incompatible}}
45 void(e1
= d
); // expected-error {{incompatible}}
46 void(d
= e1
); // FIXME: Should we warn on this?
48 void(e1
+= e1b
); // expected-error {{incompatible}}
49 void(e1
+= e2
); // expected-error {{incompatible}}
50 void(e1
+= d
); // expected-error {{incompatible}}
51 void(d
+= e1
); // expected-warning {{compound assignment of floating-point type 'double' from enumeration type 'enum E1'}}