[cfe-commits] r76758 - in /cfe/trunk/lib: AST/DeclCXX.cpp Sema/SemaDeclCXX.cpp Sema/SemaTemplateInstantiate.cpp

Douglas Gregor dgregor at apple.com
Wed Jul 22 13:56:47 PDT 2009


On Jul 22, 2009, at 1:45 PM, Fariborz Jahanian wrote:

>
> On Jul 22, 2009, at 1:32 PM, John McCall wrote:
>
>> Fariborz Jahanian wrote:
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> ====================================================================
>>> --- cfe/trunk/lib/AST/DeclCXX.cpp (original)
>>> +++ cfe/trunk/lib/AST/DeclCXX.cpp Wed Jul 22 12:41:53 2009
>>> @@ -129,7 +130,7 @@
>>>      CXXRecordDecl *VBaseClassDecl
>>>        = cast<CXXRecordDecl>(QT->getAsRecordType()->getDecl());
>>>      this->VBases[i] =
>>> -        *new CXXBaseSpecifier(
>>> +        *new (C) CXXBaseSpecifier(
>>>                          VBaseClassDecl->getSourceRange(), true,
>>>                          VBaseClassDecl->getTagKind() ==
>>> RecordDecl::TK_class,
>>>                          UniqueVbases[i]->getAccessSpecifier(), QT)
>>
>> Is there some crazy reason this needs to involve an allocation at  
>> all,
>> rather than just
>>   this->VBases[i] = CXXBaseSpecifier(...);
>
> This creates a temporary which will go out of scope when we return
> from this function.

The copy is stored in VBases[i], and that's fine. I've made this fix  
in the tree (along with fixing a few other memory-allocation-related  
issues).

	- Doug



More information about the cfe-commits mailing list