[cfe-dev] [libc++] RFC: adding a configuration option to enable constexpr constructors in c++1[xy]

David Jones via cfe-dev cfe-dev at lists.llvm.org
Wed Oct 11 17:30:58 PDT 2017


Hello,

I'm currently working on migrating a large (100M+ LOC) C++ codebase to
libc++. One particular pain point are the absence of constexpr constructors
for std::pair, std::array, and std::tuple under C++11. Some older versions
of libstdc++ expose constexpr constructors under C++11, while libc++ does
not; this causes build failures when using libc++.

I would like to add a configuration variable that enables the constexpr
qualifier on these constructors for C++11 or later, with the intent of
advancing the C++ version as quickly as possible. Most of the uses can be
trivially replaced by removing constexpr or switching to arrays, but this
is churn for code which will (hopefully) soon be compliant anyhow.

I suspect this may be useful for other codebases that build in C++11 mode
to move to libc++... however, this would be a non-conforming extension.
Adding a configuration option in __config_site.in (with the default being
conforming behaviour) seems like it may be the most reasonable way to add
the option.

Please let me know if there are any strong objections to this plan.

Thanks,
--dlj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20171011/2899b313/attachment.html>


More information about the cfe-dev mailing list