aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/cvt.c7
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0d1968f..83c43e0 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2011-05-20 Jason Merrill <jason@redhat.com>
+ PR c++/48780
+ * cvt.c (type_promotes_to): Don't promote scoped enums.
+
PR c++/49066
* decl.c (duplicate_decls): Preserve DECL_DELETED_FN.
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index db4ea46..e5d5361 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -1616,6 +1616,10 @@ type_promotes_to (tree type)
if (TREE_CODE (type) == BOOLEAN_TYPE)
type = integer_type_node;
+ /* scoped enums don't promote. */
+ else if (SCOPED_ENUM_P (type) && abi_version_at_least (6))
+ ;
+
/* Normally convert enums to int, but convert wide enums to something
wider. */
else if (TREE_CODE (type) == ENUMERAL_TYPE
@@ -1626,6 +1630,9 @@ type_promotes_to (tree type)
int precision = MAX (TYPE_PRECISION (type),
TYPE_PRECISION (integer_type_node));
tree totype = c_common_type_for_size (precision, 0);
+ if (SCOPED_ENUM_P (type))
+ warning (OPT_Wabi, "scoped enum %qT will not promote to an integral "
+ "type in a future version of GCC", type);
if (TREE_CODE (type) == ENUMERAL_TYPE)
type = ENUM_UNDERLYING_TYPE (type);
if (TYPE_UNSIGNED (type)