History

Make casts lose top-level qualifiers

Petr Skocik committed 7 years ago

Commit c81116e1 parent f85b1e32 files · +4 −0Browse files

Unified · Split

2 files
  1. tccgen.c +1 −0
  2. tests/tests2/94_generic.c +3 −0
tccgen.c+1−0
@@ -2660,6 +2660,7 @@ static void gen_cast(CType *type) · 2659 unmodified lines
2660 | (lvalue_type(type->ref->type.t) & VT_LVAL_TYPE);2660 | (lvalue_type(type->ref->type.t) & VT_LVAL_TYPE);
2661 }2661 }
2662 vtop->type = *type;2662 vtop->type = *type;
2663 vtop->type.t &= ~ ( VT_CONSTANT | VT_VOLATILE | VT_ARRAY );
2663}2664}
2664 2665
2665/* return type size as known at compile time. Put alignment at 'a' */2666/* return type size as known at compile time. Put alignment at 'a' */
tests/tests2/94_generic.c+3−0
@@ -74,5 +74,8 @@ int main() · 73 unmodified lines
74 //should accept ({ }) in the controlling expr of _Generic even in const_wanted contexts74 //should accept ({ }) in the controlling expr of _Generic even in const_wanted contexts
75 struct { _Bool x_0: _Generic(({0;}),default:1); } my_x;75 struct { _Bool x_0: _Generic(({0;}),default:1); } my_x;
76 76
77 _Generic((__typeof((float const)((float const){42}))*){0}, float*: 0); //casts lose top-level qualifiers
78 int const x = 42; __typeof((__typeof(x))x) *xp = 0; (void)_Generic(xp, int*: 0); //casts lose top-level qualifiers
79
77 return 0;80 return 0;
78}81}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t