Hi,

The problem in this PR is that the CLASSTYPE_SORTED_FIELDS is created
too early (in finish_struct_1) to handle those "late" unscoped enum
definitions.
Consequently, I propose to lately add those names in
CLASSTYPE_SORTED_FIELDS when they are encountered, in
build_enumerator.

Tested x86_64-unknown-linux-gnu, OK for 4.7 ?

gcc/testsuite/ChangeLog

2012-02-27  Fabien Chêne  <fab...@gcc.gnu.org>

        * g++.dg/cpp0x/forw_enum11.C: New.

gcc/cp/ChangeLog

2012-02-27  Fabien Chêne  <fab...@gcc.gnu.org>

        * cp-tree.h (insert_into_classtype_sorted_fields): Declare.
        * class.c (finish_struct_1): Move the code into
        insert_into_classtype_sorted_fields, and call it.
        (insert_into_classtype_sorted_fields): Define.
        * decl.c (build_enumerator): Call
        insert_into_classtype_sorted_fields if an enumerator-definition 
referring
        to a class scope opaque enum has been encountered.

-- 
Fabien

Attachment: 51214.patch
Description: Binary data

Reply via email to