Boost logo

Boost :

Subject: Re: [boost] [config] vc10 and BOOST_NO_DECLTYPE
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2010-04-20 06:06:28


Beman Dawes <bdawes_at_[hidden]> writes:

> On Tue, Apr 6, 2010 at 3:49 PM, Eric Niebler <eric_at_[hidden]> wrote:
>>...
>>
>> The issue is whether the decltype keyword is too broken on VC10 to define
>> BOOST_NO_DECLTYPE. I think it /may/ be, so we should define it just to be
>> safe, at least for 1.43.
>
> Eric, where do we stand on this? Does the VC10 decltype problem in the
> beta still exist in the final release of VC10?

decltype is still broken in the final release of VC10. e.g. the
following code deduces the return type of getOne() to be one& rather
than one, causing an error on the "res r" line. Bizarrely, this problem
goes away if NO_CONSTRUCTOR is defined, as the return type is deduced
correctly.

I am also aware of other scenarios where decltype doesn't work correctly
on VC10, but don't have good test cases for them.

class one
{
#ifndef NO_CONSTRUCTOR
public:
    one()
    {}
#endif
};

one getOne()
{
    return one();
}

template<typename F>
void baz(F f)
{
    typedef decltype(f()) res;
    res r;
}

int main()
{
    baz(getOne);
}

Anthony

-- 
Author of C++ Concurrency in Action     http://www.stdthread.co.uk/book/
just::thread C++0x thread library             http://www.stdthread.co.uk
Just Software Solutions Ltd       http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

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