re PR c++/70627 (internal compiler error: verify_type failed)

PR c++/70627

	* decl.c (start_enum): Don't change an existing ENUM_UNDERLYING_TYPE.

From-SVN: r234956
This commit is contained in:
Jason Merrill 2016-04-13 14:32:11 -04:00 committed by Jason Merrill
parent 85115fb632
commit 0d9cdbdd7a
3 changed files with 38 additions and 1 deletions

View File

@ -1,3 +1,8 @@
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

View File

@ -13253,7 +13253,10 @@ start_enum (tree name, tree enumtype, tree underlying_type,
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;

View File

@ -0,0 +1,29 @@
// 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 (); }