Make casts lose top-level qualifiers

TODO: also make them lose lvalue status
This commit is contained in:
Petr Skocik 2018-11-20 19:24:24 +01:00
parent f85b1e393f
commit c81116e29a
2 changed files with 4 additions and 0 deletions

View File

@ -2660,6 +2660,7 @@ static void gen_cast(CType *type)
| (lvalue_type(type->ref->type.t) & VT_LVAL_TYPE);
}
vtop->type = *type;
vtop->type.t &= ~ ( VT_CONSTANT | VT_VOLATILE | VT_ARRAY );
}
/* return type size as known at compile time. Put alignment at 'a' */

View File

@ -74,5 +74,8 @@ int main()
//should accept ({ }) in the controlling expr of _Generic even in const_wanted contexts
struct { _Bool x_0: _Generic(({0;}),default:1); } my_x;
_Generic((__typeof((float const)((float const){42}))*){0}, float*: 0); //casts lose top-level qualifiers
int const x = 42; __typeof((__typeof(x))x) *xp = 0; (void)_Generic(xp, int*: 0); //casts lose top-level qualifiers
return 0;
}