Boost logo

Boost :

Subject: Re: [boost] [utility][enable_if]Fiddly function lookup failure on msvc11
From: Edward Diener (eldiener_at_[hidden])
Date: 2013-10-07 09:33:08


On 10/7/2013 8:06 AM, 山本賢一 wrote:
> 2013/10/7 Gavin Lambert <gavinl_at_[hidden]>
>
>> On 10/7/2013 9:41 AM, Quoth 山本賢一:
>>
>> template <class T>
>>> struct always_true :
>>> boost::mpl::true_
>>> {
>>> };
>>>
>> [...]
>>
>> Does the behaviour change if you make always_true not a template, or if
>> you make some member of it actually depend on the template argument?
>>
>
> The behaviour changed and the code compiled if I changed always_true not a
> template.
>
> struct always_true :
> boost::mpl::true_
> {
> };
>
> template <class T> inline
> typename boost::enable_if_c<
> !boost::mpl::not_<
> always_true
> >::type::value
> , int
> > ::type

How about trying another "boost::mpl::not_" rather than "!" in the above
code. Does that make any difference ?

> get_one(T)
> {
> return 1;
> }
>
> The behaviour didn't change and the code didn't compile if I made some
> member of always_true actually depend on the template argument.
>
> template <class T>
> struct always_true :
> boost::mpl::true_
> {
> typedef typename boost::add_const<T>::type unused_type;
> };
>
> The actual condition to reproduce the issue seems very complex. My best
> guess is that msvc11 gives up resolving template-parameter-dependent
> condition and marks it as failure (in the sense of SFINAE) under a specific
> circumstance.


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