This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Change _LIBCXX_CONSTEXPR_AFTER_CXX11 to check for relaxed constexpr rules
ClosedPublic

Authored by EricWF on Jul 4 2014, 10:16 PM.

Details

Reviewers
mclow.lists
Summary

Currently libc++ will not compile in c++1y mode with GCC since GCC does not yet support relaxed constexpr rules. This patch only defines _LIBCXX_CONSTEXPR_AFTER_CXX11 only if relaxed constexpr rules are available.

This patch introduces the _LIBCXX_HAS_NO_RELAXED_CONSTEXPR macro that should be defined when a compiler does not support the relaxed constexpr rules. Currently this macro is defined:

  • On clang when __has_feature(cxx_relaxed_constexpr) is false.
  • Unconditionally on GCC.
  • Unconditionally on MSVC.

Although not all uses of _LIBCXX_CONSTEXPR_AFTER_CXX11 require the relaxed rules it would be very messy to selectively enable usages that do.

Are there any opposing viewpoints to this method of handling _LIBCPP_CONSTEXPR_AFTER_CXX11 ?

Diff Detail

Event Timeline

EricWF updated this revision to Diff 11098.Jul 4 2014, 10:16 PM
EricWF retitled this revision from to [libcxx] Change _LIBCXX_CONSTEXPR_AFTER_CXX11 to check for relaxed constexpr rules.
EricWF updated this object.
EricWF edited the test plan for this revision. (Show Details)
EricWF added a reviewer: mclow.lists.
EricWF set the repository for this revision to rL LLVM.
EricWF added a subscriber: Unknown Object (MLST).Jul 4 2014, 10:35 PM

Adding cfe-commits.

Pinging this.

mclow.lists edited edge metadata.Jul 14 2014, 4:47 PM

I don't like the name "relaxed constexpr". What if (as seems likely) the restrictions on constexpr get loosened (again) for C++17?

How about _LIBCXX_IMPLEMENTS_CXX14_CONSTEXPR instead?

P.S. Any idea on when gcc will implement this part of C++14? Might it be in 4.9.1? [ I will ping someone on the gcc side and try to find out ]

How about _LIBCPP_HAS_CXX14_CONSTEXPR since its more inline with current names?

Sorry that should be _LIBCPP_HAS_NO_CXX14_CONSTEXPR since most existing names are of the negative form.

I like _LIBCPP_HAS_NO_CXX14_CONSTEXPR.

EricWF updated this revision to Diff 11412.Jul 14 2014, 7:21 PM
EricWF edited edge metadata.

Changed the name _LIBCPP_HAS_NO_RELAXED_CONSTEXPR -> _LIBCPP_HAS_NO_CXX14_CONSTEXPR

mclow.lists accepted this revision.Jul 16 2014, 8:13 AM
mclow.lists edited edge metadata.

LGTM. Thanks!

This revision is now accepted and ready to land.Jul 16 2014, 8:13 AM
EricWF closed this revision.Jul 16 2014, 10:40 PM

Landed as r213225