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]

Re: C++ PATCH for c++/44909 (confusion with circular lazy declaration)



On 13 Jul 2010, at 23:29, Jason Merrill wrote:


In this testcase, trying to lazily declare the Ray default constructor means lazily declaring the array copy constructor, which means seeing which Vector constructor will be used for the copy, which means seeing if there's a conversion from Vector to Ray, which means lazily declaring the Ray copy constructor, which means failing to lazily declare the array copy constructor.

This patch avoids this issue by immediately declaring the constructors for array; at that point, Ray isn't a complete type, so there is no conversion from Vector to Ray, so the cycle is broken.

Tested x86_64-pc-linux-gnu, applied to trunk.
commit a2a65b8045e79a850558fe2e9157e224abf5f924
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Jul 13 15:18:59 2010 -0400

PR c++/44909
* cp-tree.h (struct lang_type_class): Add has_user_opeq.
(TYPE_HAS_USER_OPEQ): New.
* decl.c (grok_special_member_properties): Set it.
* class.c (add_implicitly_declared_members): Don't lazily declare
constructors/operator= if a base or member has a user-declared one.
(check_bases_and_members, check_bases): Adjust.
(check_field_decls, check_field_decl): Adjust.
* method.c (synthesized_method_walk): Initialize check_vdtor.

this causes two ObjC++ tests to regress.
FAIL: obj-c++.dg/cxx-ivars-{2,3}.mm -fnext-runtime (internal compiler error)


The ICE is because objc-act.c [895:918] assumes that the length of the TYPE_NEXT_VARIANT() list will not change across a call to finish_struct();

Looking at 162148 [working] and 162149 [fail]
is seems to me that, in 162149, an identical copy of the first type in the list is being pre-pended to the list (or the initial entry is duplicated, I guess).


At the moment, I can't be sure whether:

(a) that is a valid consequence of the intention of the change (and thus ObjC needs to be amended to use a different strategy for what it's doing)

(b) there is some other explanation.


cheers, Iain


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