This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On 6/1/19 2:42 PM, Ville Voutilainen wrote:
On Sat, 1 Jun 2019 at 21:09, Ed Smith-Rowland <3dw4rd@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++
<libstdc++@gcc.gnu.org> wrote:
Greetings,

Iterators for <array> and <string_view> 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


Attachment: CL_ConstexprIterator
Description: Text document

Attachment: patch_ConstexprIterator
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]