This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16693] [3.4/3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Aug 2004 09:05:13 -0000
- Subject: [Bug c++/16693] [3.4/3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
- References: <20040723171525.16693.paulg@chiark.greenend.org.uk>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From reichelt at gcc dot gnu dot org 2004-08-10 09:05 -------
Here's a condensed version (which should return 0):
=====================================
char foo()
{
return 0x10;
}
enum E { e = 0x0f };
int main()
{
return (char)(E)(e & foo());
}
=====================================
Btw, the bug only occurs with the C++ frontend and not with plain C.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |reichelt at gcc dot gnu dot
| |org
Keywords| |monitored
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16693