[External]_Re: Implement the <iterator> part of C++20 p1032 Misc constexpr bits.

Jonathan Wakely jwakely@redhat.com
Fri Nov 15 19:33:00 GMT 2019


On 15/11/19 19:12 +0000, Smith-Rowland, Edward M wrote:
>>Index: testsuite/24_iterators/headers/iterator/synopsis_c++17.cc
>>===================================================================
>>--- testsuite/24_iterators/headers/iterator/synopsis_c++17.cc  (revision 278302)
>>+++ testsuite/24_iterators/headers/iterator/synopsis_c++17.cc  (working copy)
>>@@ -89,21 +89,6 @@
>>   template <class Iterator>
>>   constexpr reverse_iterator<Iterator> make_reverse_iterator(const Iterator&);
>>
>>-  template <class Container> class back_insert_iterator;
>>-
>>-  template <class Container>
>>-  back_insert_iterator<Container> back_inserter(Container& x);
>>-
>>-  template <class Container> class front_insert_iterator;
>>-
>>-  template <class Container>
>>-  front_insert_iterator<Container> front_inserter(Container& x);
>>-
>>-  template <class Container> class insert_iterator;
>>-
>>-  template <class Container, class Iterator>
>>-  insert_iterator<Container> inserter(Container& x, Iterator i);
>>-
>>   template <class Iterator> class move_iterator;
>>
>>   template <class Iterator1, class Iterator2>
>
>This seems wrong ... these are still part of C++17, aren't they?
>
>I think we want to conditionally declare those constexpr so the test
>passes in C++20 mode as well e.g.
>
>
>OK, what I did there was to just remove those tests in synopsis_c++17.cc to a new inserters_c++17.cc (which is just run for C++17) and add a inserters_c++20.cc (which is just run for C++20) for the constexpr versions.  So I think everything should be checked with the right version.  The C++17 inserters are still checked for C++17.

Oh I see the problem, it's because I made synopsis_c++20.cc include
synopsis_c++17.cc because I was lazy.

How about leaving those declarations in synopsis_c++17.cc but
guarding them with #if __cplusplus == 201703L and then adding the
constexpr versions of them in synopsis_c++20.cc ?

I think we should also add { target c++17_only } to synopsis_c++17.cc
(which should have had a target selector anyway).



More information about the Libstdc++ mailing list