Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-06-11 Thread Jonathan Wakely

On 10/06/19 18:46 -0400, Ed Smith-Rowland via libstdc++ wrote:

On 6/10/19 2:43 AM, Ville Voutilainen wrote:

On Mon, 10 Jun 2019 at 02:53, Ed Smith-Rowland <3dw...@verizon.net> wrote:


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.

They added a test that *i++ = *j++ works, and that i != j works.


Ok,

Here is a version that adds back a hand written copy thing to test 
Ville's observation.


This is tested on a clean branch.

I would also like to add the same copy lines to the gcc-9 branch.

OK?


Ok for trunk and gcc-9-branch, thanks.




Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-06-10 Thread Ed Smith-Rowland via gcc-patches

On 6/10/19 2:43 AM, Ville Voutilainen wrote:

On Mon, 10 Jun 2019 at 02:53, Ed Smith-Rowland <3dw...@verizon.net> wrote:


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.

They added a test that *i++ = *j++ works, and that i != j works.


Ok,

Here is a version that adds back a hand written copy thing to test 
Ville's observation.


This is tested on a clean branch.

I would also like to add the same copy lines to the gcc-9 branch.

OK?

Ed


2019-06-11  Edward Smith-Rowland  <3dw...@verizon.net>

        Test C++20 - p0858 ConstexprIterator requirements.
* testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc:
New test.
* testsuite/23_containers/array/requirements/constexpr_iter.cc:
New test.

diff --git 
a/libstdc++-v3/testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc
 
b/libstdc++-v3/testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc
index 24ab502372a..799fb0391f5 100644
--- 
a/libstdc++-v3/testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc
+++ 
b/libstdc++-v3/testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc
@@ -30,7 +30,11 @@ test()
   static_assert('W' == *(hw.cbegin() + 7));
 
   std::array a2{{0,0,0,0,0,0,0,0,0,0,0,0,0}};
-  std::copy(hw.begin(), hw.end(), a2.begin());
+  auto hwi = hw.begin();
+  auto hwe = hw.end();
+  auto a2i = a2.begin();
+  while (hwi != hwe)
+*a2i++ = *hwi++;
 
   return *(hw.cbegin() + 3);
 }
diff --git 
a/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_iter.cc 
b/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_iter.cc
index 88d69d2f8c7..4b5346631c9 100644
--- a/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_iter.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_iter.cc
@@ -27,9 +27,13 @@ test()
   static_assert(1 == *a1.begin());
   auto n = a1[0] * a1[1]* a1[2];
   static_assert(1 == *a1.cbegin());
-
+ 
   std::array a2{{0, 0, 0}};
-  std::copy(a1.begin(), a1.end(), a2.begin());
+  auto a1i = a1.begin();
+  auto a1e = a1.end();
+  auto a2i = a2.begin();
+  while (a1i != a1e)
+*a2i++ = *a1i++;
 
   return n;
 }


Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-06-10 Thread Ville Voutilainen
On Mon, 10 Jun 2019 at 02:53, Ed Smith-Rowland <3dw...@verizon.net> wrote:

> 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.

They added a test that *i++ = *j++ works, and that i != j works.


Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-06-09 Thread Ed Smith-Rowland via gcc-patches

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


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 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 a2{{0, 0, 0}};
-  std::copy(a1.begin(), a1.end(), a2.begin());
-
   return n;
 }
 


Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-06-09 Thread Jonathan Wakely

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.




Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-06-09 Thread Ville Voutilainen
On Mon, 10 Jun 2019 at 01:03, 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.
>
> Please fix.

Indeed. std::copy isn't constexpr yet. I don't see how Ed's test run
can pass. We either need to put this on hold until enough of
 is constexprified,
or we need to use loops in this test and test (constexpr) algorithms'
use of (constexpr) iterators separately later.


Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-06-09 Thread Rainer Orth
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.

Please fix.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-06-09 Thread Ed Smith-Rowland via gcc-patches

On 6/8/19 4:28 PM, Jonathan Wakely wrote:

On 08/06/19 12:05 -0400, Ed Smith-Rowland wrote:

On 6/7/19 11:42 AM, Jonathan Wakely wrote:

On 01/06/19 15:40 -0400, Ed Smith-Rowland via libstdc++ wrote:

On 6/1/19 2:42 PM, Ville Voutilainen wrote:
On Sat, 1 Jun 2019 at 21:09, Ed Smith-Rowland <3dw...@verizon.net> 
wrote:

On 5/31/19 6:29 PM, Ville Voutilainen wrote:

On Sat, 1 Jun 2019 at 01:24, Ed Smith-Rowland via libstdc++
 wrote:

Greetings,

Iterators for  and  are usabe in a 
constexpr context

since C++2017.

This just adds a compile test to make sure and check a box for 
C++20

p0858 - ConstexprIterator requirements.

Those tests don't use the iterators in a constexpr context. To do
that, maybe do those std::copy operations
in a constexpr function and then initialize a constexpr variable 
with

the result of a call to that function?

Thanks Ville,

I had completely forgotten to make these test functions constexpr 
- FIXED.

.but that doesn't enforce a constexpr context. If you add another
function that calls these functions
and initializes a constexpr variable, then we have the enforcement I
seek. Such as

void test2()
{
?? constexpr char x = test();
}


Ok, third time's a charm.

I was brain dead about the constexpr patch.?? I'm now setting a 
constexpr variable from test() in a caller.


But static_assert is a constexpr context no?

Ed





2019-06-03?? Edward Smith-Rowland <3dw...@verizon.net>

????Test for C++20 p0858 - ConstexprIterator requirements.
* 
testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc:

New test.
* 
testsuite/23_containers/array/requirements/constexpr_iter.cc:

New test.



Index: 
testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc

===
--- 
testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc 
(nonexistent)
+++ 
testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc 
(working copy)

@@ -0,0 +1,43 @@
+// { dg-do compile { target c++2a } }


Please check the testsuite/libstdc++.log or testsuite/libstdc++.sum
files for the new tests. I expect they are both UNSUPPORTED.

That's because you've given a target c++2a which means they won't be
run unless a suitable -std option is given. And you haven't given one.

You need to add { dg-options "-std=gnu++2a" } before the dg-do line.

Also if the tests are restricted to C++2a then there's no point having
the #if __cplusplus > 201703L check, because that will never be false.

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.


Also, we could declare victory for this for gcc-9.?? May I backport 
after this is in?


Yes, these tests are also OK to backport to gcc-9-branch (assuming
they pass on the branch, which I agree they should do).

Thanks!

The backport is the same less the calls to std::copy. CL and patch 
attached. Committed 272097.


Ed

2019-06-09  Edward Smith-Rowland  <3dw...@verizon.net>

Test for C++20 p0858 - ConstexprIterator requirements.
* testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc:
New test.
* testsuite/23_containers/array/requirements/constexpr_iter.cc:
New test.

Index: testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc
===
--- testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc   
(nonexistent)
+++ testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc   
(working copy)
@@ -0,0 +1,39 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+//
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include 
+#include 
+
+constexpr char
+test()
+{
+  constexpr std::string_view hw("Hello, World!");
+  static_assert('H'

Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-06-08 Thread Jonathan Wakely

On 08/06/19 12:05 -0400, Ed Smith-Rowland wrote:

On 6/7/19 11:42 AM, Jonathan Wakely wrote:

On 01/06/19 15:40 -0400, Ed Smith-Rowland via libstdc++ wrote:

On 6/1/19 2:42 PM, Ville Voutilainen wrote:
On Sat, 1 Jun 2019 at 21:09, Ed Smith-Rowland 
<3dw...@verizon.net> wrote:

On 5/31/19 6:29 PM, Ville Voutilainen wrote:

On Sat, 1 Jun 2019 at 01:24, Ed Smith-Rowland via libstdc++
 wrote:

Greetings,

Iterators for  and  are usabe in a 
constexpr context

since C++2017.

This just adds a compile test to make sure and check a box for C++20
p0858 - ConstexprIterator requirements.

Those tests don't use the iterators in a constexpr context. To do
that, maybe do those std::copy operations
in a constexpr function and then initialize a constexpr variable with
the result of a call to that function?

Thanks Ville,

I had completely forgotten to make these test functions 
constexpr - FIXED.

.but that doesn't enforce a constexpr context. If you add another
function that calls these functions
and initializes a constexpr variable, then we have the enforcement I
seek. Such as

void test2()
{
?? constexpr char x = test();
}


Ok, third time's a charm.

I was brain dead about the constexpr patch.?? I'm now setting a 
constexpr variable from test() in a caller.


But static_assert is a constexpr context no?

Ed





2019-06-03?? Edward Smith-Rowland <3dw...@verizon.net>

????Test for C++20 p0858 - ConstexprIterator requirements.
* testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc:
New test.
* testsuite/23_containers/array/requirements/constexpr_iter.cc:
New test.




Index: testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc
===
--- testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc 
(nonexistent)
+++ testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc 
(working copy)

@@ -0,0 +1,43 @@
+// { dg-do compile { target c++2a } }


Please check the testsuite/libstdc++.log or testsuite/libstdc++.sum
files for the new tests. I expect they are both UNSUPPORTED.

That's because you've given a target c++2a which means they won't be
run unless a suitable -std option is given. And you haven't given one.

You need to add { dg-options "-std=gnu++2a" } before the dg-do line.

Also if the tests are restricted to C++2a then there's no point having
the #if __cplusplus > 201703L check, because that will never be false.

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.

Also, we could declare victory for this for gcc-9.?? May I backport 
after this is in?


Yes, these tests are also OK to backport to gcc-9-branch (assuming
they pass on the branch, which I agree they should do).

Thanks!




Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-06-08 Thread Ed Smith-Rowland via gcc-patches

On 6/7/19 11:42 AM, Jonathan Wakely wrote:

On 01/06/19 15:40 -0400, Ed Smith-Rowland via libstdc++ wrote:

On 6/1/19 2:42 PM, Ville Voutilainen wrote:
On Sat, 1 Jun 2019 at 21:09, Ed Smith-Rowland <3dw...@verizon.net> 
wrote:

On 5/31/19 6:29 PM, Ville Voutilainen wrote:

On Sat, 1 Jun 2019 at 01:24, Ed Smith-Rowland via libstdc++
 wrote:

Greetings,

Iterators for  and  are usabe in a constexpr 
context

since C++2017.

This just adds a compile test to make sure and check a box for C++20
p0858 - ConstexprIterator requirements.

Those tests don't use the iterators in a constexpr context. To do
that, maybe do those std::copy operations
in a constexpr function and then initialize a constexpr variable with
the result of a call to that function?

Thanks Ville,

I had completely forgotten to make these test functions constexpr - 
FIXED.

.but that doesn't enforce a constexpr context. If you add another
function that calls these functions
and initializes a constexpr variable, then we have the enforcement I
seek. Such as

void test2()
{
?? constexpr char x = test();
}


Ok, third time's a charm.

I was brain dead about the constexpr patch.?? I'm now setting a 
constexpr variable from test() in a caller.


But static_assert is a constexpr context no?

Ed





2019-06-03?? Edward Smith-Rowland <3dw...@verizon.net>

????Test for C++20 p0858 - ConstexprIterator requirements.
* 
testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc:

New test.
* testsuite/23_containers/array/requirements/constexpr_iter.cc:
New test.



Index: 
testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc

===
--- 
testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc 
(nonexistent)
+++ 
testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc 
(working copy)

@@ -0,0 +1,43 @@
+// { dg-do compile { target c++2a } }


Please check the testsuite/libstdc++.log or testsuite/libstdc++.sum
files for the new tests. I expect they are both UNSUPPORTED.

That's because you've given a target c++2a which means they won't be
run unless a suitable -std option is given. And you haven't given one.

You need to add { dg-options "-std=gnu++2a" } before the dg-do line.

Also if the tests are restricted to C++2a then there's no point having
the #if __cplusplus > 201703L check, because that will never be false.

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?

Also, we could declare victory for this for gcc-9.?? May I backport after 
this is in?


Ed


2019-06-10  Edward Smith-Rowland  <3dw...@verizon.net>

Test for C++20 p0858 - ConstexprIterator requirements.
* testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc:
New test.
* testsuite/23_containers/array/requirements/constexpr_iter.cc:
New test.

Index: testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc
===
--- testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc   
(nonexistent)
+++ testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc   
(working copy)
@@ -0,0 +1,42 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+//
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include 
+#include 
+
+constexpr char
+test()
+{
+  constexpr std::string_view hw("Hello, World!");
+  static_assert('H' == *hw.begin());
+  auto ch = hw[4];
+  static_assert('W' == *(hw.cbegin() + 7));
+
+  std::array 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);
+}
+
+void
+run_test()
+{
+  constexpr char ch = test();
+}
Index: testsuite/23_containers/array/requirements/constexpr_iter.cc

Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-06-07 Thread Jonathan Wakely

On 07/06/19 16:42 +0100, Jonathan Wakely wrote:

On 01/06/19 15:40 -0400, Ed Smith-Rowland via libstdc++ wrote:

On 6/1/19 2:42 PM, Ville Voutilainen wrote:

On Sat, 1 Jun 2019 at 21:09, Ed Smith-Rowland <3dw...@verizon.net> wrote:

On 5/31/19 6:29 PM, Ville Voutilainen wrote:

On Sat, 1 Jun 2019 at 01:24, Ed Smith-Rowland via libstdc++
 wrote:

Greetings,

Iterators for  and  are usabe in a constexpr context
since C++2017.

This just adds a compile test to make sure and check a box for C++20
p0858 - ConstexprIterator requirements.

Those tests don't use the iterators in a constexpr context. To do
that, maybe do those std::copy operations
in a constexpr function and then initialize a constexpr variable with
the result of a call to that function?

Thanks Ville,

I had completely forgotten to make these test functions constexpr - FIXED.

.but that doesn't enforce a constexpr context. If you add another
function that calls these functions
and initializes a constexpr variable, then we have the enforcement I
seek. Such as

void test2()
{
   constexpr char x = test();
}


Ok, third time's a charm.

I was brain dead about the constexpr patch.?? I'm now setting a 
constexpr variable from test() in a caller.


But static_assert is a constexpr context no?

Ed





2019-06-03  Edward Smith-Rowland  <3dw...@verizon.net>

    Test for C++20 p0858 - ConstexprIterator requirements.
* testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc:
New test.
* testsuite/23_containers/array/requirements/constexpr_iter.cc:
New test.




Index: testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc
===
--- testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc   
(nonexistent)
+++ testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc   
(working copy)
@@ -0,0 +1,43 @@
+// { dg-do compile { target c++2a } }


Please check the testsuite/libstdc++.log or testsuite/libstdc++.sum
files for the new tests. I expect they are both UNSUPPORTED.

That's because you've given a target c++2a which means they won't be
run unless a suitable -std option is given. And you haven't given one.

You need to add { dg-options "-std=gnu++2a" } before the dg-do line.

Also if the tests are restricted to C++2a then there's no point having
the #if __cplusplus > 201703L check, because that will never be false.


I've enhanced my badtests.awk script to check for this case, and it
found a problem with 24_iterators/container_access.cc (the dg-options
needs to be first or the -std option isn't used when checking the
effective target).

Tested x86_64-linux, committed to trunk.

commit 728a466ed5258be419aecd8cc8dbaa62d8364cba
Author: Jonathan Wakely 
Date:   Fri Jun 7 20:54:39 2019 +0100

Fix test that gets skipped as unsupported

* testsuite/24_iterators/container_access.cc: Move dg-options before
dg-do directive so the target check uses the -std option.

diff --git a/libstdc++-v3/testsuite/24_iterators/container_access.cc b/libstdc++-v3/testsuite/24_iterators/container_access.cc
index 4346b3b6b8c..b9fd3194fe9 100644
--- a/libstdc++-v3/testsuite/24_iterators/container_access.cc
+++ b/libstdc++-v3/testsuite/24_iterators/container_access.cc
@@ -1,5 +1,5 @@
-// { dg-do run { target c++17 } }
 // { dg-options "-std=gnu++17" }
+// { dg-do run { target c++17 } }
 
 // Copyright (C) 2015-2019 Free Software Foundation, Inc.
 //


Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-06-07 Thread Jonathan Wakely

On 01/06/19 15:40 -0400, Ed Smith-Rowland via libstdc++ wrote:

On 6/1/19 2:42 PM, Ville Voutilainen wrote:

On Sat, 1 Jun 2019 at 21:09, Ed Smith-Rowland <3dw...@verizon.net> wrote:

On 5/31/19 6:29 PM, Ville Voutilainen wrote:

On Sat, 1 Jun 2019 at 01:24, Ed Smith-Rowland via libstdc++
 wrote:

Greetings,

Iterators for  and  are usabe in a constexpr context
since C++2017.

This just adds a compile test to make sure and check a box for C++20
p0858 - ConstexprIterator requirements.

Those tests don't use the iterators in a constexpr context. To do
that, maybe do those std::copy operations
in a constexpr function and then initialize a constexpr variable with
the result of a call to that function?

Thanks Ville,

I had completely forgotten to make these test functions constexpr - FIXED.

.but that doesn't enforce a constexpr context. If you add another
function that calls these functions
and initializes a constexpr variable, then we have the enforcement I
seek. Such as

void test2()
{
constexpr char x = test();
}


Ok, third time's a charm.

I was brain dead about the constexpr patch.?? I'm now setting a 
constexpr variable from test() in a caller.


But static_assert is a constexpr context no?

Ed





2019-06-03  Edward Smith-Rowland  <3dw...@verizon.net>

    Test for C++20 p0858 - ConstexprIterator requirements.
* testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc:
New test.
* testsuite/23_containers/array/requirements/constexpr_iter.cc:
New test.




Index: testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc
===
--- testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc   
(nonexistent)
+++ testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc   
(working copy)
@@ -0,0 +1,43 @@
+// { dg-do compile { target c++2a } }


Please check the testsuite/libstdc++.log or testsuite/libstdc++.sum
files for the new tests. I expect they are both UNSUPPORTED.

That's because you've given a target c++2a which means they won't be
run unless a suitable -std option is given. And you haven't given one.

You need to add { dg-options "-std=gnu++2a" } before the dg-do line.

Also if the tests are restricted to C++2a then there's no point having
the #if __cplusplus > 201703L check, because that will never be false.


Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-06-01 Thread Ville Voutilainen
On Sat, 1 Jun 2019 at 22:40, Ed Smith-Rowland <3dw...@verizon.net> wrote:

> Ok, third time's a charm.
>
> I was brain dead about the constexpr patch.?? I'm now setting a constexpr
> variable from test() in a caller.

Looks good. Jonathan needs to approve it, though.

> But static_assert is a constexpr context no?

Yes, it is. It's just that now all of test() is verified to be okay as
a constant expression, including std::copy.


Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-06-01 Thread Ed Smith-Rowland via gcc-patches

On 6/1/19 2:42 PM, Ville Voutilainen wrote:

On Sat, 1 Jun 2019 at 21:09, Ed Smith-Rowland <3dw...@verizon.net> wrote:

On 5/31/19 6:29 PM, Ville Voutilainen wrote:

On Sat, 1 Jun 2019 at 01:24, Ed Smith-Rowland via libstdc++
 wrote:

Greetings,

Iterators for  and  are usabe in a constexpr context
since C++2017.

This just adds a compile test to make sure and check a box for C++20
p0858 - ConstexprIterator requirements.

Those tests don't use the iterators in a constexpr context. To do
that, maybe do those std::copy operations
in a constexpr function and then initialize a constexpr variable with
the result of a call to that function?

Thanks Ville,

I had completely forgotten to make these test functions constexpr - FIXED.

.but that doesn't enforce a constexpr context. If you add another
function that calls these functions
and initializes a constexpr variable, then we have the enforcement I
seek. Such as

void test2()
{
 constexpr char x = test();
}


Ok, third time's a charm.

I was brain dead about the constexpr patch.?? I'm now setting a constexpr 
variable from test() in a caller.


But static_assert is a constexpr context no?

Ed


2019-06-03  Edward Smith-Rowland  <3dw...@verizon.net>

    Test for C++20 p0858 - ConstexprIterator requirements.
* testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc:
New test.
* testsuite/23_containers/array/requirements/constexpr_iter.cc:
New test.

Index: testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc
===
--- testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc   
(nonexistent)
+++ testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc   
(working copy)
@@ -0,0 +1,43 @@
+// { dg-do compile { target c++2a } }
+//
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include 
+#include 
+
+constexpr char
+test()
+{
+  constexpr std::string_view hw("Hello, World!");
+  static_assert('H' == *hw.begin());
+  auto ch = hw[4];
+  static_assert('W' == *(hw.cbegin() + 7));
+
+#if __cplusplus > 201703L
+  std::array a2{{0,0,0,0,0,0,0,0,0,0,0,0,0}};
+  std::copy(hw.begin(), hw.end(), a2.begin());
+#endif
+
+  return *(hw.cbegin() + 3);
+}
+
+void
+run_test()
+{
+  constexpr char ch = test();
+}
Index: testsuite/23_containers/array/requirements/constexpr_iter.cc
===
--- testsuite/23_containers/array/requirements/constexpr_iter.cc
(nonexistent)
+++ testsuite/23_containers/array/requirements/constexpr_iter.cc
(working copy)
@@ -0,0 +1,42 @@
+// { dg-do compile { target c++2a } }
+//
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include 
+
+constexpr int
+test()
+{
+  constexpr std::array a1{{1, 2, 3}};
+  static_assert(1 == *a1.begin());
+  auto n = a1[0] * a1[1]* a1[2];
+  static_assert(1 == *a1.cbegin());
+
+#if __cplusplus > 201703L
+  std::array a2{{0, 0, 0}};
+  std::copy(a1.begin(), a1.end(), a2.begin());
+#endif
+
+  return n;
+}
+
+void
+run_test()
+{
+  constexpr int n = test();
+}


Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-06-01 Thread Ville Voutilainen
On Sat, 1 Jun 2019 at 21:09, Ed Smith-Rowland <3dw...@verizon.net> wrote:
>
> On 5/31/19 6:29 PM, Ville Voutilainen wrote:
> > On Sat, 1 Jun 2019 at 01:24, Ed Smith-Rowland via libstdc++
> >  wrote:
> >> Greetings,
> >>
> >> Iterators for  and  are usabe in a constexpr context
> >> since C++2017.
> >>
> >> This just adds a compile test to make sure and check a box for C++20
> >> p0858 - ConstexprIterator requirements.
> >
> > Those tests don't use the iterators in a constexpr context. To do
> > that, maybe do those std::copy operations
> > in a constexpr function and then initialize a constexpr variable with
> > the result of a call to that function?
>
> Thanks Ville,
>
> I had completely forgotten to make these test functions constexpr - FIXED.

..but that doesn't enforce a constexpr context. If you add another
function that calls these functions
and initializes a constexpr variable, then we have the enforcement I
seek. Such as

void test2()
{
constexpr char x = test();
}


Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-06-01 Thread Ed Smith-Rowland via gcc-patches

On 5/31/19 6:29 PM, Ville Voutilainen wrote:

On Sat, 1 Jun 2019 at 01:24, Ed Smith-Rowland via libstdc++
 wrote:

Greetings,

Iterators for  and  are usabe in a constexpr context
since C++2017.

This just adds a compile test to make sure and check a box for C++20
p0858 - ConstexprIterator requirements.


Those tests don't use the iterators in a constexpr context. To do
that, maybe do those std::copy operations
in a constexpr function and then initialize a constexpr variable with
the result of a call to that function?


Thanks Ville,

I had completely forgotten to make these test functions constexpr - FIXED.

Also, instead of bool variables I put the checks in static_asserts.

I return functions of (derefed) iterators.

I made it so we could run these at C++17 if we want to with '#if 
__cplusplus == 201703L' the algorithm usage for C++20 only.?? This wasn't 
a DR though.


Anyway, that should do it.

Built and tested clean on x86_64-linux. Ok?

Ed


2019-06-03  Edward Smith-Rowland  <3dw...@verizon.net>

    Test for C++20 p0858 - ConstexprIterator requirements.
* testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc:
New test.
* testsuite/23_containers/array/requirements/constexpr_iter.cc:
New test.

Index: testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc
===
--- testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc   
(nonexistent)
+++ testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc   
(working copy)
@@ -0,0 +1,37 @@
+// { dg-do compile { target c++2a } }
+//
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include 
+#include 
+
+constexpr char
+test()
+{
+  constexpr std::string_view hw("Hello, World!");
+  static_assert('H' == *hw.begin());
+  auto ch = hw[4];
+  static_assert('W' == *(hw.cbegin() + 7));
+
+#if __cplusplus > 201703L
+  std::array a2{{0,0,0,0,0,0,0,0,0,0,0,0,0}};
+  std::copy(hw.begin(), hw.end(), a2.begin());
+#endif
+
+  return *(hw.cbegin() + 3);
+}
Index: testsuite/23_containers/array/requirements/constexpr_iter.cc
===
--- testsuite/23_containers/array/requirements/constexpr_iter.cc
(nonexistent)
+++ testsuite/23_containers/array/requirements/constexpr_iter.cc
(working copy)
@@ -0,0 +1,36 @@
+// { dg-do compile { target c++2a } }
+//
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include 
+
+constexpr int
+test()
+{
+  constexpr std::array a1{{1, 2, 3}};
+  static_assert(1 == *a1.begin());
+  auto n = a1[0] * a1[1]* a1[2];
+  static_assert(1 == *a1.cbegin());
+
+#if __cplusplus > 201703L
+  std::array a2{{0, 0, 0}};
+  std::copy(a1.begin(), a1.end(), a2.begin());
+#endif
+
+  return n;
+}


Re: Test for C++20 p0858 - ConstexprIterator requirements.

2019-05-31 Thread Ville Voutilainen
On Sat, 1 Jun 2019 at 01:24, Ed Smith-Rowland via libstdc++
 wrote:
>
> Greetings,
>
> Iterators for  and  are usabe in a constexpr context
> since C++2017.
>
> This just adds a compile test to make sure and check a box for C++20
> p0858 - ConstexprIterator requirements.


Those tests don't use the iterators in a constexpr context. To do
that, maybe do those std::copy operations
in a constexpr function and then initialize a constexpr variable with
the result of a call to that function?


Test for C++20 p0858 - ConstexprIterator requirements.

2019-05-31 Thread Ed Smith-Rowland via gcc-patches

Greetings,

Iterators for  and  are usabe in a constexpr context 
since C++2017.


This just adds a compile test to make sure and check a box for C++20 
p0858 - ConstexprIterator requirements.


Ed


2019-06-03  Edward Smith-Rowland  <3dw...@verizon.net>

    Test for C++20 p0858 - ConstexprIterator requirements.
* testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc:
New test.
* testsuite/23_containers/array/requirements/constexpr_iter.cc:
New test.

Index: testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc
===
--- testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc   
(nonexistent)
+++ testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc   
(working copy)
@@ -0,0 +1,33 @@
+// { dg-do compile { target c++2a } }
+//
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include 
+#include 
+
+void
+test()
+{
+  constexpr std::string_view hw("Hello, World!");
+  bool ok = 'H' == *hw.begin();
+  auto ch = hw[4];
+  bool cok = 'W' == *(hw.cbegin() + 7);
+
+  std::array a2{{0,0,0,0,0,0,0,0,0,0,0,0,0}};
+  std::copy(hw.begin(), hw.end(), a2.begin());
+}
Index: testsuite/23_containers/array/requirements/constexpr_iter.cc
===
--- testsuite/23_containers/array/requirements/constexpr_iter.cc
(nonexistent)
+++ testsuite/23_containers/array/requirements/constexpr_iter.cc
(working copy)
@@ -0,0 +1,32 @@
+// { dg-do compile { target c++2a } }
+//
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include 
+
+void
+test()
+{
+  constexpr std::array a1{{1, 2, 3}};
+  bool ok = 1 == *a1.begin();
+  auto n = a1[0] * a1[1]* a1[2];
+  bool cok = 1 == *a1.cbegin();
+
+  std::array a2{{0, 0, 0}};
+  std::copy(a1.begin(), a1.end(), a2.begin());
+}