Boost logo

Boost :

Subject: Re: [boost] [result_of] fails with clan (C++11)
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-11-27 16:50:51


On Tue, Nov 27, 2012 at 1:28 PM, Peter Dimov <lists_at_[hidden]> wrote:

> Mathias Gaunard wrote:
>
>> On 27/11/12 21:56, Jeffrey Lee Hellrung, Jr. wrote:
>> > On Tue, Nov 27, 2012 at 12:47 PM, Oliver Kowalke
>> > <oliver.kowalke_at_[hidden]>**wrote:
>> >
>> >> Hello,
>> >> clang (c++11 support) fails on code like:
>> >>
>> >> BOOST_STATIC_ASSERT((
>> >> is_same< void, typename result_of< Fn() >::type >>
>> >::value));
>> >>
>> >> with error:
>> >>
>> >> no type named 'type' in 'boost::result_of<void (&())(X &)>'
>> >> is_same< void, typename result_of< Fn() >::type >>
>> >::value));
>> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~****~~
>> >>
>> >
>> > Does Fn == void (&)(X&) or void (X&) ? I.e., is it a unary function >
>> type?
>> >
>> > There might've been a recent change only for Clang to allow result_of
>> to > be
>> > better usable with SFINAE: result_of< F ( Args... ) > doesn't have a >
>> nested
>> > type typedef if F ( Args... ) is ill-formed (which appears to be the >
>> case
>> > here).
>>
>> And the person who did that change didn't think of running the test?
>>
>
> The test looks broken. A function that takes X& can't be called with zero
> arguments.
>

Yes, the assertion looks wrong, though something that would pass with the
non-decltype implementation of result_of...which might explain its failure
on clang if clang was switched to used decltype? Everything I've said in
this thread is speculation, by the way.

- Jeff


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