Boost logo

Boost :

Subject: Re: [boost] Boost.Test and Xcode 4.5 in C++11 Mode
From: Daniel James (dnljms_at_[hidden])
Date: 2012-11-15 14:32:22


On 15 November 2012 15:32, Andrey Semashev <andrey.semashev_at_[hidden]> wrote:
> On Thu, Nov 15, 2012 at 7:24 PM, Daniel James <dnljms_at_[hidden]> wrote:
>> On 15 November 2012 14:54, Daniel James <dnljms_at_[hidden]> wrote:
>>>
>>> I tried building with Clang 3.1 in C++11 mode, and I got the same
>>> errors as you.
>>
>> I think it's a clang bug, here's a test case:
>>
>> template <typename T> struct foo {};
>> foo<decltype(1 > 0)> x;
>>
>> It thinks the '>' from '1 > 0' is an angle bracket, I guess it has
>> been fixed on clang trunk. A workaround is just to double the round
>> brackets. I've attached a patch that I used to get Boost.Test to
>> compile. It's a bit messy though.
>
> Note there is difference between decltype(x) and decltype((x)), so the
> change may alter the behavior. I didn't examine the code to confirm
> that though, just a heads up.

Well, that's annoying. Just had a very quick read up on the issue, and
I think it's okay. The expression is:

    typename boost::remove_reference<
        decltype((boost::declval<Lhs>() oper
            boost::declval<Rhs>() ))>::type result_type;

'oper' is a macro parameter, which is never '.' or '->' (obviously,
given that it wouldn't work). So I don't think it counts as an id or
member expression. 'oper' is '->*' in one case, but I don't think
that's affected? If it is, the 'remove_reference' should help, maybe
it would need to use 'remove_const' as well?

Btw. please can someone with clang from subversion try the test case?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk