Step 2 (of N?) fixing bug 16599

Howard Hinnant howard.hinnant at gmail.com
Mon Jul 15 16:43:03 PDT 2013


On Jul 15, 2013, at 5:19 PM, Marshall Clow <mclow.lists at gmail.com> wrote:

> This is the second step towards fixing http://llvm.org/bugs/show_bug.cgi?id=16599
> 
> Make std::pair's constructors and comparison operators (and make_pair) constexpr.

This is looking great!

I've got just a few minor tweaks, and one big favor... ;-)

While you're in the pair neighborhood, it would be great if you could do a drive-by fix on the pair copy and move constructors concerning making them = default when _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS is not defined, but keeping the current definitions when _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS is defined.

Otherwise I can find nothing at all to complain about in <utility>.

On the tests I think we need to test every constructor we're marking constexpr.  The easiest way to ensure complete coverage is when you think you have it, comment out the constexpr on the constructors one by one and make sure you have a failing test.  utility/pairs/pairs.pair has an attempted test/per constructor.  We should put a constexpr test in each of those files targeting the relevant constructor.

The make_pair test should go in utility/pairs/pair.spec/make_pair.pass.cpp.  And the comparison operator tests should go in utility/pairs/pair.spec/comparison.pass.cpp.  This will add some duplication in the tests, but that way we can find all of the relevant tests when we have a bug report in this area a year from now.

Thanks much!

Howard





More information about the cfe-commits mailing list