summaryrefslogtreecommitdiffstats
path: root/libcxx/test/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2013-07-22 16:02:19 +0000
committerMarshall Clow <mclow.lists@gmail.com>2013-07-22 16:02:19 +0000
commit75eff74803140f4e0d8713b7d55f8da70472b10b (patch)
treefd012f65e854909f272a29cdf60f706b3d4a3510 /libcxx/test/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp
parent087f926a241bd70b16e47cd061a555d6add8d1ce (diff)
downloadbcm5719-llvm-75eff74803140f4e0d8713b7d55f8da70472b10b.tar.gz
bcm5719-llvm-75eff74803140f4e0d8713b7d55f8da70472b10b.zip
Make tuple's constructor and std::get<>(tuple) constexpr. Final stage of fixing bug #16599. Thanks to Howard for the review and updates.
llvm-svn: 186834
Diffstat (limited to 'libcxx/test/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp')
-rw-r--r--libcxx/test/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/libcxx/test/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp b/libcxx/test/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp
index 33aed89b073..bcdb9d99b9b 100644
--- a/libcxx/test/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp
+++ b/libcxx/test/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp
@@ -30,6 +30,26 @@ struct D
explicit D(int i) : B(i) {}
};
+#if _LIBCPP_STD_VER > 11
+
+struct A
+{
+ int id_;
+
+ constexpr A(int i) : id_(i) {}
+ friend constexpr bool operator==(const A& x, const A& y) {return x.id_ == y.id_;}
+};
+
+struct C
+{
+ int id_;
+
+ constexpr explicit C(int i) : id_(i) {}
+ friend constexpr bool operator==(const C& x, const C& y) {return x.id_ == y.id_;}
+};
+
+#endif
+
int main()
{
{
@@ -39,6 +59,22 @@ int main()
T1 t1 = t0;
assert(std::get<0>(t1) == 2);
}
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::tuple<double> T0;
+ typedef std::tuple<A> T1;
+ constexpr T0 t0(2.5);
+ constexpr T1 t1 = t0;
+ static_assert(std::get<0>(t1) == 2, "");
+ }
+ {
+ typedef std::tuple<int> T0;
+ typedef std::tuple<C> T1;
+ constexpr T0 t0(2);
+ constexpr T1 t1{t0};
+ static_assert(std::get<0>(t1) == C(2), "");
+ }
+#endif
{
typedef std::tuple<double, char> T0;
typedef std::tuple<int, int> T1;
OpenPOWER on IntegriCloud