This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ Patch] for c++/51214


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  <fabien@gcc.gnu.org>

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

gcc/cp/ChangeLog

2012-02-27  Fabien Chêne  <fabien@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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]