Test for C++20 p0858 - ConstexprIterator requirements.

Ed Smith-Rowland via gcc-patches gcc-patches@gcc.gnu.org
Sun Jun 9 23:53:00 GMT 2019


On 6/9/19 6:28 PM, Jonathan Wakely wrote:
> On 10/06/19 00:03 +0200, Rainer Orth wrote:
>> Hi Ed,
>>
>>>>> I had supplied the option for gnu++2a by hand and they passed.?? They
>>>>> were not UNSUPPORTED.
>>>>>
>>>>> I just added the dg-options (at very top) and reran the testsuite
>>>>> without fancy tricks (except for gnu++2a).
>>>>>
>>>>> I also took out the #if __cplusplus.?? I was just playing around and
>>>>> discovered that these pass in C++17 if you comment out the C++20
>>>>> constexpr algos.
>>>>>
>>>>> OK for trunk?
>>>>
>>>> OK for trunk.
>>> Committed 272084.
>>
>> 272085 actually ;-)?? Unfortunately, the new tests seem to FAIL (almost?)
>> everywhere:
>>
>> +FAIL: 21_strings/basic_string_view/requirements/constexpr_iter.cc 
>> (test for excess errors)
>>
>> Excess errors:
>> /vol/gcc/src/hg/trunk/local/libstdc++-v3/testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc:33: 
>> error: call to non-'constexpr' function '_OI std::copy(_II, _II, _OI) 
>> [with _II = const char*; _OI = int*]'
>> /vol/gcc/src/hg/trunk/local/libstdc++-v3/testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc:41: 
>> error: 'constexpr char test()' called in a constant expression
>>
>> +FAIL: 23_containers/array/requirements/constexpr_iter.cc (test for 
>> excess errors)
>>
>> /vol/gcc/src/hg/trunk/local/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_iter.cc:32: 
>> error: call to non-'constexpr' function '_OI std::copy(_II, _II, _OI) 
>> [with _II = const int*; _OI = int*]'
>> /vol/gcc/src/hg/trunk/local/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_iter.cc:40: 
>> error: 'constexpr int test()' called in a constant expression
>>
>> I'm seeing those on i386-pc-solaris2.11 and sparc-sun-solaris2.11, and
>> there are gcc-testresults reports on aarch64-unknown-linux-gnu,
>> i686-pc-linux-gnu, powerpc64le-unknown-linux-gnu, and
>> x86_64-pc-linux-gnu, among others.
>
> Presumably because std::copy isn't actually constexpr yet.
>
> Ed, do you have uncommitted local changes that allow this test to
> pass? Because I don't see how it can pass otherwise.
>
Darn it, I had those constexpr lib patches in tree.

Attached are what I just committed to gcc-9 and passes there. Those 
std::copy didn't really add anything anyway.

Note to self - no matter how small work on a separate branch.

I'm testing on a new clean branch unless someone beats me to it.

Sorry for all the noise.

Ed


-------------- next part --------------
Index: testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc
===================================================================
--- testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc	(revision 272098)
+++ testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc	(working copy)
@@ -29,9 +29,6 @@
   auto ch = hw[4];
   static_assert('W' == *(hw.cbegin() + 7));
 
-  std::array<int, hw.size()> a2{{0,0,0,0,0,0,0,0,0,0,0,0,0}};
-  std::copy(hw.begin(), hw.end(), a2.begin());
-
   return *(hw.cbegin() + 3);
 }
 
Index: testsuite/23_containers/array/requirements/constexpr_iter.cc
===================================================================
--- testsuite/23_containers/array/requirements/constexpr_iter.cc	(revision 272098)
+++ testsuite/23_containers/array/requirements/constexpr_iter.cc	(working copy)
@@ -28,9 +28,6 @@
   auto n = a1[0] * a1[1]* a1[2];
   static_assert(1 == *a1.cbegin());
 
-  std::array<int, 3> a2{{0, 0, 0}};
-  std::copy(a1.begin(), a1.end(), a2.begin());
-
   return n;
 }
 


More information about the Gcc-patches mailing list