[Bug c++/84701] New: casting to ( typeof(variable) ) gives wrong results
jim.avera at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Mar 5 06:28:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84701
Bug ID: 84701
Summary: casting to ( typeof(variable) ) gives wrong results
Product: gcc
Version: 7.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jim.avera at gmail dot com
Target Milestone: ---
typedef short foo_t;
foo_t s = -1; /* FFFF */
unsigned u = (unsigned foo_t)s; /* result is FFFF */
unsigned u = (unsigned typeof(s))s; /* result is FFFFFFFF */
There is no warning using g++ -Wall -W.
It would be nice if using typeof(var) in a cast would either work, or cause a
compiler error!
More information about the Gcc-bugs
mailing list