<div dir="ltr">On Wed, Nov 27, 2013 at 3:31 PM, Howard Hinnant <span dir="ltr"><<a href="mailto:howard.hinnant@gmail.com" target="_blank">howard.hinnant@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Nov 26, 2013, at 5:04 PM, Peter Collingbourne <<a href="mailto:peter@pcc.me.uk">peter@pcc.me.uk</a>> wrote:<br>

<br>
> Hi rsmith, howard.hinnant,<br>
><br>
> libstdc++ always declares various entities as constexpr if C++14 makes<br>
> them constexpr, even in C++11 mode. To support programs which rely on this<br>
> behavior, start applying constexpr to those entities in C++11 mode only if<br>
> GNU extensions are enabled (i.e. -std=gnu++11).<br>
><br>
> We have to be selective about which entities we do this for because of the<br>
> relaxed constexpr rules in C++14.<br>
><br>
> This patch applies the change to entities in <utility>, as well as its<br>
> dependencies, std::move and std::forward.<br>
><br>
> <a href="http://llvm-reviews.chandlerc.com/D2276" target="_blank">http://llvm-reviews.chandlerc.com/D2276</a><br>
><br>
> Files:<br>
>  include/__config<br>
>  include/__tuple<br>
>  include/type_traits<br>
>  include/utility<br>
>  test/utilities/utility/pairs/pair.astuple/get_const.pass.cpp<br>
>  test/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp<br>
>  test/utilities/utility/pairs/pair.astuple/pairs.by.type1.fail.cpp<br>
>  test/utilities/utility/pairs/pair.astuple/pairs.by.type2.fail.cpp<br>
>  test/utilities/utility/pairs/pair.astuple/pairs.by.type3.fail.cpp<br>
>  test/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp<br>
>  test/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp<br>
>  test/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp<br>
>  test/utilities/utility/pairs/pairs.pair/default.pass.cpp<br>
>  test/utilities/utility/pairs/pairs.spec/comparison.pass.cpp<br>
>  test/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp<br>
</div></div>> <D2276.1.patch><br>
<br>
I find myself wondering if the following would not be simpler and more flexible:<br>
<br>
In <__config>:<br>
<br>
#if _LIBCPP_STD_VER <= 11<br>
#  ifndef _LIBCPP_CONSTEXPR_AFTER_CXX11<br>
#    define _LIBCPP_CONSTEXPR_AFTER_CXX11<br>
#  endif<br>
#  define _LIBCPP_EXPLICIT_AFTER_CXX11<br>
#  define _LIBCPP_DEPRECATED_AFTER_CXX11<br>
#else<br>
#  ifndef _LIBCPP_CONSTEXPR_AFTER_CXX11<br>
#    define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr<br>
#  endif<br>
#  define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit<br>
#  define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]<br>
#endif<br>
<br>
I.e. Allow the client to define _LIBCPP_CONSTEXPR_AFTER_CXX11 however he wants.  And if he does, his definition is respected.  Otherwise it defaults to how it is currently defined with _LIBCPP_STD_VER <= 11.<br></blockquote>
</div><br></div><div class="gmail_extra">That would be problematic, because there are some places where C++1y adds constexpr to functions where constexpr cannot be added in C++11 (non-const member functions, functions that aren't defined as a single return statement, and so on).</div>
</div>