[PATCH] Fix an assertion failure trying to emit a trivial destructor in ObjC++

John McCall rjmccall at apple.com
Tue Sep 16 11:45:51 PDT 2014


On Sep 15, 2014, at 9:47 AM, Ben Langmuir <blangmuir at apple.com> wrote:
> Hi John,
> 
> This patch fixes the assertion failure I talked to you about in Objective C++ codegen.  It turned out to have nothing to do with templates.
> 
>    Fix an assertion failure trying to emit a trivial destructor in ObjC++
> 
>    If a base class declares a destructor, we will add the implicit
>    destructor for the subclass in
>    ActOnFields -> AddImplicitlyDeclaredMembersToClass
> 
>    But in Objective C++, we did not compute whether we have a trivial
>    destructor until after that in
>    CXXRecordDecl::completeDefinition()
> 
>    This was leading to a mismatch between the class, which thought it had
>    no trivial destructor, and the CXXDestructorDecl, which considered
>    itself trivial.

I feel like hasTrivialDestructor should return the right value here.  I understand (and am saddened by) the hack about not setting PlainOldData until completeDefinition, but maybe we can set/clear the rest of the bits eagerly?

John.



More information about the cfe-commits mailing list