|
Boost : |
Subject: Re: [boost] [config] call to destructor of temporary
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-10-15 02:55:51
Le 15/10/12 01:08, Mathias Gaunard a écrit :
> On 15/10/2012 00:24, Vicente J. Botet Escriba wrote:
>> Hi,
>>
>> I have had some trouble debugging some code with clang-2.9 c++0x. The
>> reason was a known bug on the compiler as it doesn't call the destructor
>> of temporaries at the end of the expression.
>>
>> Is there a macro stating this missing feature?
>
> That's a severe bug, doesn't look like any workaround would fix it
>
>
Yes you are right.
In my particular case the bug manifest at the test side and the library
already provided an interface that allows workaround
S s;
#if BOOST_NO_XXX
{
U u=s.make_u();
u->append("foo/");
}
#else
s->append("foo/"); // S::operator->() returns a temporary for which
the destructor must be called here
#endif
Ah, the bug doesn't appear with all the temporaries, and that
s.make_u()->append("foo/");
works.
I don't know yet if this is limited to the temporaries that operator->
could return. While this is a severe bug, the workaround seems
reasonable. Of course on compilers with such a bug S::operator->() will
not be available.
Note that I have no special interest in supporting this compiler, if the
Boost community don't support it.
Best,
Vicente
P.S.
U S::operator->()
{
return S(*this));
}
U S::make_u()
{
return S(*this));
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk