Boost logo

Boost :

Subject: Re: [boost] [MP11] Loosing const-qualification on type result with GCC 4.8 only
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2019-04-27 20:32:15

On 19-04-26 01:05:12, Mateusz Loskot wrote:
>(initially posted to
>I prepared a lenghty MWE which reproduces my problem with
>type manipulation using MP11 that for some reason looses
>const-qualification on a ::type result
>Here it is at and copied below.
>I hope the XXXXXX comments make sense and important static
>assertions in the main() at the bottom explain what
>is the expected result.
> [...]
>To summary, I expect this to yield true:
> <
> mp11::mp_at_c<reference3_list, 0>
> bit_range_reference<std::uint8_t, 0, 3, true> const
> >
>I got this confirmed by all GCC versions but GCC 4.8.
>(clang and MSVC also seem to agree with the GCC >= 4.9)
>Is mp11::mp_transform loosing const-qualification
>or have I made a mistake somewhere?

For the archive completeness, in case anyone is looking
for answer to similar question:

As Peter confirmed on the Slack, MP11 originally supported
GCC 4.9+ and 4.8 support is partial, not without issues.
My use case above was hit but one of such issues,
in GCC 4.8, as commented here:
    // g++ 4.7, 4.8 have difficulties with preserving top-level const
    BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke_q<Q, void>, void const>));
    BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke_q<Q, int[]>, int const[]>));

Since GCC 4.8 is dying, it's a good idea to stop using it
where MP11 + C++11 is required.

Best regards,

Mateusz Loskot,
Fingerprint=C081 EA1B 4AFB 7C19 38BA  9C88 928D 7C2A BB2A C1F2

Boost list run by bdawes at, gregod at, cpdaniel at, john at