This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/58319] New: explicit cast doesn't disable -Wconversion warning.
- From: "pluto at agmk dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 05 Sep 2013 08:09:36 +0000
- Subject: [Bug other/58319] New: explicit cast doesn't disable -Wconversion warning.
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58319
Bug ID: 58319
Summary: explicit cast doesn't disable -Wconversion warning.
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
Assignee: unassigned at gcc dot gnu.org
Reporter: pluto at agmk dot net
$ cat u.cpp
struct X { unsigned field : 31; };
int main()
{
unsigned u = 0u;
X x = { .field = static_cast< typeof( X::field ) >( u ) };
return x.field;
}
$ g++ u.cpp -c -Wconversion
u.cpp: In function âint main()â:
u.cpp:6:58: warning: conversion to âunsigned int:31â from âunsigned intâ may
alter its value [-Wconversion]
X x = { .field = static_cast< typeof( X::field ) >( u ) };
^