[Bug c++/51242] [C++11] Unable to use strongly typed enums as bit fields
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Nov 19 11:52:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51242
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-11-19 11:52:38 UTC ---
The check is for an unscoped enumeration type which does seem intentional.
This change allows the example to compile:
--- cp/decl2.c.orig 2012-11-19 11:50:28.842443803 +0000
+++ cp/decl2.c 2012-11-19 11:46:08.445472115 +0000
@@ -1026,7 +1026,7 @@
if (TREE_CODE (value) == VOID_TYPE)
return void_type_node;
- if (!INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (value))
+ if (!INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (value))
&& (POINTER_TYPE_P (value)
|| !dependent_type_p (TREE_TYPE (value))))
{
It emits a warning though:
e.cc:5:19: warning: 'MyClass::Field1' is too small to hold all values of 'enum
class MyEnum' [enabled by default]
More information about the Gcc-bugs
mailing list