summaryrefslogtreecommitdiffstats
path: root/libcxx/src
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-06-26 21:01:34 +0000
committerEric Fiselier <eric@efcs.ca>2016-06-26 21:01:34 +0000
commit555330719a31dd4294741493781bebe41cd6afbb (patch)
tree28c58919d4be621838e5299eb421a5fa0909bd3e /libcxx/src
parenta9fb19d3a5337428a0b1cd6d15818b2395e8caf8 (diff)
downloadbcm5719-llvm-555330719a31dd4294741493781bebe41cd6afbb.tar.gz
bcm5719-llvm-555330719a31dd4294741493781bebe41cd6afbb.zip
Implement LWG 2488 - Make the placeholders constexpr.
This patch makes the bind placeholders in std::placeholders both (1) const and (2) constexpr (See below). This is technically a breaking change for any code using the placeholders outside of std::bind and depending on them being non-const. However I don't think this will break any real world code. (1) Previously the placeholders were non-const extern globals in all dialects. This patch changes these extern globals to be const in all dialects. Since the cv-qualifiers don't participate in name mangling for globals this is an ABI compatible change. (2) Make the placeholders constexpr in C++11 and beyond. Although LWG 2488 only applies to C++17 I don't see any reason not to backport this change. llvm-svn: 273824
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/bind.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/libcxx/src/bind.cpp b/libcxx/src/bind.cpp
index cab0b7c03a9..b318fc16979 100644
--- a/libcxx/src/bind.cpp
+++ b/libcxx/src/bind.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+#define _LIBCPP_BUILDING_BIND
#include "functional"
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -14,16 +15,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace placeholders
{
-__ph<1> _1;
-__ph<2> _2;
-__ph<3> _3;
-__ph<4> _4;
-__ph<5> _5;
-__ph<6> _6;
-__ph<7> _7;
-__ph<8> _8;
-__ph<9> _9;
-__ph<10> _10;
+const __ph<1> _1{};
+const __ph<2> _2{};
+const __ph<3> _3{};
+const __ph<4> _4{};
+const __ph<5> _5{};
+const __ph<6> _6{};
+const __ph<7> _7{};
+const __ph<8> _8{};
+const __ph<9> _9{};
+const __ph<10> _10{};
} // placeholders
OpenPOWER on IntegriCloud