PR c++/70627
* decl.c (start_enum): Don't change an existing ENUM_UNDERLYING_TYPE.
From-SVN: r234956
+2016-04-13 Jason Merrill <jason@redhat.com>
+
+ PR c++/70627
+ * decl.c (start_enum): Don't change an existing ENUM_UNDERLYING_TYPE.
+
2016-04-13 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/70635
if (underlying_type)
{
- if (CP_INTEGRAL_TYPE_P (underlying_type))
+ if (ENUM_UNDERLYING_TYPE (enumtype))
+ /* We already checked that it matches, don't change it to a different
+ typedef variant. */;
+ else if (CP_INTEGRAL_TYPE_P (underlying_type))
{
copy_type_enum (enumtype, underlying_type);
ENUM_UNDERLYING_TYPE (enumtype) = underlying_type;
--- /dev/null
+// PR c++/70627
+// { dg-do compile { target c++11 } }
+
+struct D;
+struct A
+{
+ D *operator->();
+};
+struct B
+{
+ template <typename... T> void foo (T &&...) {}
+};
+typedef unsigned char G;
+enum class H : G;
+struct C
+{
+};
+struct D : C
+{
+ B foo () const { B a; a.foo (d); }
+ H d;
+};
+struct F : C
+{
+ void foo ();
+ A f;
+};
+enum class H : unsigned char;
+void F::foo () { B b = f->foo (); }