[libcxx-dev] Enable _LIBCPP_ENABLE_*_REMOVED_* by default in -std=gnu++NN?

James Y Knight via libcxx-dev libcxx-dev at lists.llvm.org
Wed Jun 3 17:11:10 PDT 2020


It seems to me like it may be reasonable to increment the default language
version in Clang from -std=gnu++14 to -std=gnu++17 soon.

However, one issue is that a *lot* of code is broken by libc++'s removal of
auto_ptr, random_shuffle, bind1st/bind2nd, ptr_fun/mem_fun/mem_fun_ref/etc.
(And almost nothing is broken by the removal of {set_,get_,}unexpected, but
I'm not sure it makes sense to actually treat that differently.)

Given:
1. There is a large amount of existing usage of these functions/classes.
2. GCC has not, and has no plans to, remove them from libstdc++.
3. We ought to continue incrementing the default C++ language version in
clang.
4. It would be good not to break vast swaths of existing code while doing
so.

I propose that we modify the libc++ configuration to define
_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES unless __STRICT_ANSI__ is defined.

That define is set only if the user explicitly passes --std=c++XX. In the
default compilation mode, the removed functionality would continue to be
available, and only users who ask for a strict compliance mode would get an
error.

I think that would strike a reasonable balance between not unnecessarily
breaking code, and moving things forward.

Thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-dev/attachments/20200603/f1d3ce73/attachment.html>


More information about the libcxx-dev mailing list