|
Boost : |
Subject: Re: [boost] [mpl] Problem with VC++14 and boost::mpl::size_t
From: Edward Diener (eldiener_at_[hidden])
Date: 2015-07-25 16:34:14
On 7/25/2015 2:48 AM, Matt Calabrese wrote:
> On Fri, Jul 24, 2015 at 7:41 PM, Edward Diener <eldiener_at_[hidden]>
> wrote:
>
>> pointing to the line after it encounters 'struct size_t' as far as I can
>> make out ( you need to preprocess the size_t.cpp test, comment out the
>> #line directives and run the test against the preprocessed result to see
>> what the compiler is objecting to ). It therefore fails a number of mpl
>> tests which all prior versions of VC++ pass.
>>
>> It flags this error in 5 mpl tests which use the boost::mpl::size_t
>> integral wrapper, among which the easiest to analyze is the size_t.cpp test
>> itself.
>>
>> Anybody have any idea what is going on here with the compiler, or whether
>> it can be fixed somehow in VC++14 for the mpl code ?
>>
>
> I don't have the compiler, but my guess is it's probably actually confused
> on the line:
>
> typedef size_t type;
>
> A simple workaround to try could be to change the typedef to:
>
> typedef mpl::size_t<N> type;
>
> If that fix works, I'd be surprised if such a change would break any other
> compilers. This is all just a guess, though.
>
Actually this program, which is what the boost::mpl::size_t outputs as
in VC++14, compiles without error in VC++14:
#include <cstddef>
namespace boost { namespace mpl {
struct integral_c_tag { static const int value = 0; };
template< std::size_t N >
struct size_t
{
static const std::size_t value = N;
typedef size_t type;
typedef std::size_t value_type;
typedef integral_c_tag tag;
typedef boost::mpl::size_t< static_cast<std::size_t>((value + 1)) >
next;
typedef boost::mpl::size_t< static_cast<std::size_t>((value - 1)) >
prior;
operator std::size_t() const { return
static_cast<std::size_t>(this->value); }
};
template< std::size_t N >
std::size_t const boost::mpl::size_t< N >::value;
}}
int main()
{
return 0;
}
So why the MPL tests which use boost::mpl::size_t are failing is still a
mystery to me. When the error message shows in the size_t test it says:
size_t.cpp(30): error C2872: 'size_t': ambiguous symbol
predefined C++ types (compiler internal)(16): note: could be 'unsigned
int size_t'
C:\Programming\VersionControl\modular-boost\boost/mpl/aux_/integral_wrapper.hpp(44):
note: or 'boost::mpl::size_t'
but the first line of the error message is pointing to the last empty
line of size_t.cpp. If I preprocess the file and then test the
preprocessed file, the error message is:
size_t_ii.cpp(68259): error C2872: 'size_t': ambiguous symbol
predefined C++ types (compiler internal)(16): note: could be 'unsigned
int size_t'
size_t_ii.cpp(16566): note: or 'boost::mpl::size_t'
but here the first line of the error message is pointing to one beyond
the last line of the preprocessed file.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk