added test related to issue #1201

This commit is contained in:
mrdudz 2020-08-26 23:20:28 +02:00
parent 39a3de3119
commit c1a514c0f8
1 changed files with 25 additions and 0 deletions

25
test/val/bug1201.c Normal file
View File

@ -0,0 +1,25 @@
/* bug #1201 - The unary operators +, - and ~ should do integer promote on the result types. */
char a;
short b;
int c;
long d;
enum E {
Z
} e;
struct S {
int a : 1;
} f;
_Static_assert(sizeof(+a) == sizeof(int), "Result type should be int");
_Static_assert(sizeof(+b) == sizeof(int), "Result type should be int");
_Static_assert(sizeof(+c) == sizeof(int), "Result type should be int");
_Static_assert(sizeof(+d) == sizeof(long), "Result type should be long");
_Static_assert(sizeof(+e) == sizeof(int), "Result type should be int");
_Static_assert(sizeof(+f.a) == sizeof(int), "Result type should be int");
int main(void)
{
return 0;
}