; function parameters used in other parameters and the return type.
; First selectable in G++ 4.6.
;
+; 6: The version of the ABI that doesn't promote scoped enums to int.
+; First selectable in G++ 4.7.
+;
; Additional positive integers will be assigned as new versions of
; the ABI become the default version of the ABI.
fabi-version=
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.
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
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)
function pointer types, decltype of a plain decl, and use of a
function parameter in the declaration of another parameter.
+Version 6 corrects the promotion behavior of C++0x scoped enums.
+
See also @option{-Wabi}.
@item -fno-access-control
+2011-05-20 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/enum12.C: New.
+ * g++.dg/cpp0x/enum13.C: New.
+
2011-05-21 Janus Weil <janus@gcc.gnu.org>
PR fortran/48699
--- /dev/null
+// PR c++/48780
+// { dg-options "-std=c++0x -fabi-version=0" }
+
+typedef __builtin_va_list __gnuc_va_list;
+typedef __gnuc_va_list va_list;
+
+enum struct A : short { X };
+
+void foo(int x, ...) {
+ va_list vl;
+ __builtin_va_start(vl, x);
+ enum A t = __builtin_va_arg(vl, enum A);
+ __builtin_va_end(vl);
+}
+
+int main() {
+ foo(0, A::X);
+}
--- /dev/null
+// PR c++/48780
+// { dg-options "-std=c++0x -fabi-version=5 -Wabi" }
+
+typedef __builtin_va_list __gnuc_va_list;
+typedef __gnuc_va_list va_list;
+
+enum struct A : short { X };
+
+void foo(int x, ...) {
+ va_list vl;
+ __builtin_va_start(vl, x);
+ enum A t = __builtin_va_arg(vl, enum A); // { dg-warning "promote" }
+ __builtin_va_end(vl);
+}
+
+int main() {
+ foo(0, A::X); // { dg-warning "will not promote" }
+}
+
+// { dg-prune-output "note" }