[patch] Fix two libstdc++ test failures with -std=gnu++14

François Dumont frs.dumont@gmail.com
Sat Jun 20 09:49:00 GMT 2015


On 16/06/2015 22:45, Jonathan Wakely wrote:
> On 16/06/15 22:18 +0200, François Dumont wrote:
>> On 12/06/2015 01:22, Jonathan Wakely wrote:
>>> This fixes two test failures when the default compiler mode is
>>> -std=gnu++14
>>>
>>> FAIL: 25_algorithms/headers/algorithm/synopsis.cc (test for excess
>>> errors)
>>> FAIL: ext/profile/mutex_extensions_neg.cc (test for excess errors)
>>>
>>> I don't really like the change to the synopsis.cc test, but I don't
>>> think reproducing the SFINAE constraints in the test is ideal either.
>>>
>>> The mutex_extensions_neg.cc test works now, but I think we're missing
>>> specializations of __is_tuple_like_impl for __gnu_debug::array and
>>> __gnu_profile::array.
>>>
>>> Tested powerpc64le-linux, committed to trunk.
>>>
>> This patch introduced a regression in
>> 20_util/tuple/creation_functions/tuple_cat.cc in debug mode.
>
> Yes, I noticed this today while testing some changes to <debug/list>,
> but hadn't had time to do anything about it, so thanks for taking care
> of it.
>
>> Attached is a proposal to fix it properly. I am using <utility> as a
>> pivot header between <tuple> and <array>. This way <tuple> do not need
>> to include <array> anymore.
>
> I think that's a good improvement.

But it doesn't work. <array> needs to be included before tuple to make
sure that constexpr involving array will work.

So here is a less ambitious patch keeping <array> in <tuple>.

What I don't understand is that when I try to remove <array> from
<tuple> following code stop working:

#include <tuple>
#include <array>

static_assert(std::is_same<decltype
          (std::tuple_cat(std::declval<std::array<int, 3>>())),
              std::tuple<int, int, int>>::value, "Error");

but if I invert <tuple> and <array> it does work.

Now with <array> in <tuple> it works fine in any situation. However when
I write:

#include <tuple>
#include <debug/array>

static_assert(std::is_same<decltype
          (std::tuple_cat(std::declval<std::__debug::array<int, 3>>())),
              std::tuple<int, int, int>>::value, "Error");

it works too and I don't understand why !

    * include/debug/array: Include normal array. Add version namespace when
    specializing tuple interface to array. Add specialization for
    __is_tuple_like_impl.
    * include/profile/array: Likewise.
    * include/std/array: Include <utility>. Add specialization for
    __is_tuple_like_impl.
    * include/std/tuple
    (__is_tuple_like_impl<>, __is_tuple_like_impl<pair>): Move...
    * include/std/utility: ... here. Include <type_traits>.

Tested under Linux x86_64 normal and debug modes.

Ok to commit ?

François


-------------- next part --------------
A non-text attachment was scrubbed...
Name: tuple_like.patch
Type: text/x-patch
Size: 4912 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20150620/84953b90/attachment.bin>


More information about the Libstdc++ mailing list