// FIXME: <=> should never produce -Wsign-compare warnings. All the possible error
// cases involve narrowing conversions and so are ill-formed.
(void)(a<=>(unsignedlong)b);// expected-warning {{comparison of integers of different signs}}
(void)(a<=>(unsignedint)b);
(void)(a<=>(unsignedshort)b);
(void)(a<=>(unsignedchar)b);
(void)((long)a<=>b);// expected-warning {{comparison of integers of different signs}}
(void)((int)a<=>b);// expected-warning {{comparison of integers of different signs}}
(void)((short)a<=>b);// expected-warning {{comparison of integers of different signs}}
(void)((signedchar)a<=>b);// expected-warning {{comparison of integers of different signs}}
(void)((long)a<=>(unsignedlong)b);// expected-warning {{comparison of integers of different signs}}
(void)((int)a<=>(unsignedint)b);// expected-warning {{comparison of integers of different signs}}
(void)((short)a<=>(unsignedshort)b);
(void)((signedchar)a<=>(unsignedchar)b);
#if 0
// (A,b)
(void)(A<=>(unsignedlong)b);
(void)(A<=>(unsignedint)b);
(void)(A<=>(unsignedshort)b);
(void)(A<=>(unsignedchar)b);
(void)((long)A<=>b);
(void)((int)A<=>b);
(void)((short)A<=>b);
(void)((signedchar)A<=>b);
(void)((long)A<=>(unsignedlong)b);
(void)((int)A<=>(unsignedint)b);
(void)((short)A<=>(unsignedshort)b);
(void)((signedchar)A<=>(unsignedchar)b);
// (a,B)
(void)(a<=>(unsignedlong)B);
(void)(a<=>(unsignedint)B);
(void)(a<=>(unsignedshort)B);
(void)(a<=>(unsignedchar)B);
(void)((long)a<=>B);
(void)((int)a<=>B);
(void)((short)a<=>B);
(void)((signedchar)a<=>B);
(void)((long)a<=>(unsignedlong)B);
(void)((int)a<=>(unsignedint)B);
(void)((short)a<=>(unsignedshort)B);
(void)((signedchar)a<=>(unsignedchar)B);
// (C,b)
(void)(C<=>(unsignedlong)b);
(void)(C<=>(unsignedint)b);
(void)(C<=>(unsignedshort)b);// expected-warning {{comparison of constant 'C' (65536) with expression of type 'unsigned short' is always 'std::strong_ordering::greater'}}
(void)(C<=>(unsignedchar)b);// expected-warning {{comparison of constant 'C' (65536) with expression of type 'unsigned char' is always 'std::strong_ordering::greater'}}
(void)((long)C<=>b);
(void)((int)C<=>b);
(void)((short)C<=>b);
(void)((signedchar)C<=>b);
(void)((long)C<=>(unsignedlong)b);
(void)((int)C<=>(unsignedint)b);
(void)((short)C<=>(unsignedshort)b);
(void)((signedchar)C<=>(unsignedchar)b);
// (a,C)
(void)(a<=>(unsignedlong)C);
(void)(a<=>(unsignedint)C);
(void)(a<=>(unsignedshort)C);
(void)(a<=>(unsignedchar)C);
(void)((long)a<=>C);
(void)((int)a<=>C);
(void)((short)a<=>C);// expected-warning {{comparison of constant 'C' (65536) with expression of type 'short' is always 'std::strong_ordering::less'}}
(void)((signedchar)a<=>C);// expected-warning {{comparison of constant 'C' (65536) with expression of type 'signed char' is always 'std::strong_ordering::less'}}
(void)((long)a<=>(unsignedlong)C);
(void)((int)a<=>(unsignedint)C);
(void)((short)a<=>(unsignedshort)C);
(void)((signedchar)a<=>(unsignedchar)C);
#endif
// (0x80000,b)
(void)(0x80000<=>(unsignedlong)b);
(void)(0x80000<=>(unsignedint)b);
(void)(0x80000<=>(unsignedshort)b);// expected-warning {{result of comparison of constant 524288 with expression of type 'unsigned short' is always 'std::strong_ordering::greater'}}
(void)(0x80000<=>(unsignedchar)b);// expected-warning {{result of comparison of constant 524288 with expression of type 'unsigned char' is always 'std::strong_ordering::greater'}}
(void)((long)0x80000<=>b);
(void)((int)0x80000<=>b);
(void)((short)0x80000<=>b);
(void)((signedchar)0x80000<=>b);
(void)((long)0x80000<=>(unsignedlong)b);
(void)((int)0x80000<=>(unsignedint)b);
(void)((short)0x80000<=>(unsignedshort)b);
(void)((signedchar)0x80000<=>(unsignedchar)b);
// (a,0x80000)
(void)(a<=>(unsignedlong)0x80000);// expected-warning {{comparison of integers of different signs}}
(void)(a<=>(unsignedint)0x80000);
(void)(a<=>(unsignedshort)0x80000);
(void)(a<=>(unsignedchar)0x80000);
(void)((long)a<=>0x80000);
(void)((int)a<=>0x80000);
(void)((short)a<=>0x80000);// expected-warning {{comparison of constant 524288 with expression of type 'short' is always 'std::strong_ordering::less'}}
(void)((signedchar)a<=>0x80000);// expected-warning {{comparison of constant 524288 with expression of type 'signed char' is always 'std::strong_ordering::less'}}
(void)((long)a<=>(unsignedlong)0x80000);// expected-warning {{comparison of integers of different signs}}
(void)((int)a<=>(unsignedint)0x80000);// expected-warning {{comparison of integers of different signs}}
(void)((short)a<=>(unsignedshort)0x80000);
(void)((signedchar)a<=>(unsignedchar)0x80000);
}
voidtest5(boolb){
(void)(b<=>-10);// expected-warning{{comparison of constant -10 with expression of type 'bool' is always 'std::strong_ordering::greater'}}
(void)(b<=>-1);// expected-warning{{comparison of constant -1 with expression of type 'bool' is always 'std::strong_ordering::greater'}}
(void)(b<=>0);
(void)(b<=>1);
(void)(b<=>2);// expected-warning{{comparison of constant 2 with expression of type 'bool' is always 'std::strong_ordering::less'}}
(void)(b<=>10);// expected-warning{{comparison of constant 10 with expression of type 'bool' is always 'std::strong_ordering::less'}}
}
voidtest6(signedcharsc){
(void)(sc<=>200);// expected-warning{{comparison of constant 200 with expression of type 'signed char' is always 'std::strong_ordering::less'}}
(void)(200<=>sc);// expected-warning{{comparison of constant 200 with expression of type 'signed char' is always 'std::strong_ordering::greater'}}
}
// Test many signedness combinations.
voidtest7(unsignedlongother){
// Common unsigned, other unsigned, constant unsigned