2012/5/7 Jason Merrill <ja...@redhat.com>: > On 05/06/2012 04:06 PM, Fabien Chêne wrote: >> >> + if (late_enum_values) >> + VEC_safe_push (tree, gc, late_enum_values, decl); > > I would think you could walk the TYPE_VALUES list directly, rather than copy > it into a temporary VEC.
Indeed, let's use good old tree lists. Tested x86_64-unknown-linux-gnu, OK for trunk and 4.7 ? gcc/testsuite/ChangeLog 2012-05-23 Fabien Chêne <fab...@gcc.gnu.org> PR c++/51214 * g++.dg/cpp0x/forw_enum11.C: New. gcc/cp/ChangeLog 2012-05-23 Fabien Chêne <fab...@gcc.gnu.org> PR c++/51214 * cp-tree.h (insert_late_enum_def_into_classtype_sorted_fields): Declare. * class.c (insert_into_classtype_sorted_fields): New. (add_enum_fields_to_record_type): New. (count_fields): Adjust the comment. (add_fields_to_record_type): Likewise. (finish_struct_1): Move the code that inserts the fields for the sorted case, into insert_into_classtype_sorted_fields, and call it. (insert_late_enum_def_into_classtype_sorted_fields): Define. * decl.c (finish_enum_value_list): Call insert_late_enum_def_into_classtype_sorted_fields if a late enum definition is encountered. -- Fabien
51214.patch
Description: Binary data