This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Adding constexpr to some member functions of std::array
Needs ReviewPublic

Authored by AntonBikineev on Jun 2 2016, 9:03 AM.

Details

Summary

As specified in 23.3.7.1.

Diff Detail

Repository
rL LLVM

Event Timeline

AntonBikineev retitled this revision from to [libcxx] Adding constexpr to some member functions of std::array.
AntonBikineev updated this object.
AntonBikineev added reviewers: rsmith, mclow.lists.
AntonBikineev set the repository for this revision to rL LLVM.
mclow.lists edited edge metadata.Jun 2 2016, 11:36 AM

The code changes look good to me.

For the tests, what we've done is to put the tests in with the other tests for that feature.
take a look at test/std/containers/sequences/array/front_back.pass.cpp for an example.

AntonBikineev edited edge metadata.

Marshall,
I've updated the diff according to your comments. I also added support for reverse_iterator to be constexpr.

General inconsistency with the constexpr macros.

We need to be clear that this is a C++17 feature (it was introduced via a paper, rather than an issue).

include/array
164

I don't think this is right. This is a C++17 feature, we don't want to enable this for C++14 (which is was _LIBCPP_CONSTEXPR_AFTER_CXX11 does).

You need to use _LIBCPP_CONSTEXPR_AFTER_CXX14 for this.

include/iterator
566

Why just _LIBCPP_CONSTEXPR here?

569

And here you *did* use _LIBCPP_CONSTEXPR_AFTER_CXX14.

test/std/containers/sequences/array/front_back.pass.cpp
84

These tests need to be bracketed with a #if TEST_STD_VER > 14

It seems to me that there should be a lot more tests here, too.
You've added constexpr in a lot of routines, but I only see tests for a few of them.

include/iterator