diff mbox series

C++ PATCH to add test for DR 685

Message ID 20191008162533.GA2954@redhat.com
State New
Headers show
Series C++ PATCH to add test for DR 685 | expand

Commit Message

Marek Polacek Oct. 8, 2019, 4:25 p.m. UTC
I noticed we've fixed this DR already.  It added [conv.prom]/4 and
type_promotes_to implements it:

      /* ISO C++17, 7.6/4.  A prvalue of an unscoped enumeration type
         whose underlying type is fixed (10.2) can be converted to a
         prvalue of its underlying type. Moreover, if integral promotion
         can be applied to its underlying type, a prvalue of an unscoped
         enumeration type whose underlying type is fixed can also be 
         converted to a prvalue of the promoted underlying type.  */

Tested on x86_64-linux, applying to trunk.

2019-10-08  Marek Polacek  <polacek@redhat.com>

	DR 685 - Integral promotion of enum ignores fixed underlying type.
	* g++.dg/cpp0x/scoped_enum9.C: New test.
diff mbox series

Patch

diff --git gcc/testsuite/g++.dg/cpp0x/scoped_enum9.C gcc/testsuite/g++.dg/cpp0x/scoped_enum9.C
new file mode 100644
index 00000000000..f38f26dc35b
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp0x/scoped_enum9.C
@@ -0,0 +1,11 @@ 
+// DR 685 - Integral promotion of enumeration ignores fixed underlying type.
+// { dg-do compile { target c++11 } }
+
+enum E: long { e };
+
+void f(int);
+int f(long);
+
+void g() {
+  int k = f(e);
+}