re PR c++/51248 (ICE with pointer to enum)
PR c++/51248 * decl.c (copy_type_enum): Also update variants. (finish_enum): Allow variants of complete enums. From-SVN: r182345
This commit is contained in:
parent
3c72114c42
commit
2f074b08d4
|
@ -1,3 +1,9 @@
|
|||
2011-12-14 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/51248
|
||||
* decl.c (copy_type_enum): Also update variants.
|
||||
(finish_enum): Allow variants of complete enums.
|
||||
|
||||
2011-12-14 Dodji Seketeli <dodji@redhat.com>
|
||||
|
||||
PR c++/51475
|
||||
|
|
|
@ -11908,15 +11908,19 @@ xref_basetypes (tree ref, tree base_list)
|
|||
static void
|
||||
copy_type_enum (tree dst, tree src)
|
||||
{
|
||||
TYPE_MIN_VALUE (dst) = TYPE_MIN_VALUE (src);
|
||||
TYPE_MAX_VALUE (dst) = TYPE_MAX_VALUE (src);
|
||||
TYPE_SIZE (dst) = TYPE_SIZE (src);
|
||||
TYPE_SIZE_UNIT (dst) = TYPE_SIZE_UNIT (src);
|
||||
SET_TYPE_MODE (dst, TYPE_MODE (src));
|
||||
TYPE_PRECISION (dst) = TYPE_PRECISION (src);
|
||||
TYPE_ALIGN (dst) = TYPE_ALIGN (src);
|
||||
TYPE_USER_ALIGN (dst) = TYPE_USER_ALIGN (src);
|
||||
TYPE_UNSIGNED (dst) = TYPE_UNSIGNED (src);
|
||||
tree t;
|
||||
for (t = dst; t; t = TYPE_NEXT_VARIANT (t))
|
||||
{
|
||||
TYPE_MIN_VALUE (t) = TYPE_MIN_VALUE (src);
|
||||
TYPE_MAX_VALUE (t) = TYPE_MAX_VALUE (src);
|
||||
TYPE_SIZE (t) = TYPE_SIZE (src);
|
||||
TYPE_SIZE_UNIT (t) = TYPE_SIZE_UNIT (src);
|
||||
SET_TYPE_MODE (dst, TYPE_MODE (src));
|
||||
TYPE_PRECISION (t) = TYPE_PRECISION (src);
|
||||
TYPE_ALIGN (t) = TYPE_ALIGN (src);
|
||||
TYPE_USER_ALIGN (t) = TYPE_USER_ALIGN (src);
|
||||
TYPE_UNSIGNED (t) = TYPE_UNSIGNED (src);
|
||||
}
|
||||
}
|
||||
|
||||
/* Begin compiling the definition of an enumeration type.
|
||||
|
@ -12285,9 +12289,12 @@ finish_enum (tree enumtype)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Here there should not be any variants of this type. */
|
||||
/* If this is a forward declaration, there should not be any variants,
|
||||
though we can get a variant in the middle of an enum-specifier with
|
||||
wacky code like 'enum E { e = sizeof(const E*) };' */
|
||||
gcc_assert (enumtype == TYPE_MAIN_VARIANT (enumtype)
|
||||
&& !TYPE_NEXT_VARIANT (enumtype));
|
||||
&& (TYPE_VALUES (enumtype)
|
||||
|| !TYPE_NEXT_VARIANT (enumtype)));
|
||||
}
|
||||
|
||||
/* Build and install a CONST_DECL for an enumeration constant of the
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2011-12-14 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/51248
|
||||
* g++.dg/other/enum2.C: New.
|
||||
|
||||
2011-12-14 Dodji Seketeli <dodji@redhat.com>
|
||||
|
||||
PR c++/51475
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
// PR c++/51248
|
||||
|
||||
enum E { e = sizeof(const E*) };
|
Loading…
Reference in New Issue