diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2013-07-17 18:25:36 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2013-07-17 18:25:36 +0000 |
commit | 8bf1f08a2cea3d28e173555c11bfab59dd16b231 (patch) | |
tree | 37c1f9b79dd01398a31d9b0d0b477ebc8581c41f /libcxx/test/utilities | |
parent | 39655749295f739a5dc51cbe5a5e541485ba2a5b (diff) | |
download | bcm5719-llvm-8bf1f08a2cea3d28e173555c11bfab59dd16b231.tar.gz bcm5719-llvm-8bf1f08a2cea3d28e173555c11bfab59dd16b231.zip |
Make std::get constexpr
llvm-svn: 186525
Diffstat (limited to 'libcxx/test/utilities')
-rw-r--r-- | libcxx/test/utilities/utility/pairs/pair.astuple/get_const.pass.cpp | 6 | ||||
-rw-r--r-- | libcxx/test/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp | 18 |
2 files changed, 20 insertions, 4 deletions
diff --git a/libcxx/test/utilities/utility/pairs/pair.astuple/get_const.pass.cpp b/libcxx/test/utilities/utility/pairs/pair.astuple/get_const.pass.cpp index 43e70ea5233..fcda3664d9b 100644 --- a/libcxx/test/utilities/utility/pairs/pair.astuple/get_const.pass.cpp +++ b/libcxx/test/utilities/utility/pairs/pair.astuple/get_const.pass.cpp @@ -31,10 +31,8 @@ int main() { typedef std::pair<int, short> P; constexpr P p1(3, 4); - static_assert(p1.first == 3, "" ); // for now! - static_assert(p1.second == 4, "" ); // for now! -// static_assert(std::get<0>(p1) == 3, ""); -// static_assert(std::get<1>(p1) == 4, ""); + static_assert(std::get<0>(p1) == 3, ""); + static_assert(std::get<1>(p1) == 4, ""); } #endif } diff --git a/libcxx/test/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp b/libcxx/test/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp index ebfbe9e45d4..6d61c47ffbf 100644 --- a/libcxx/test/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp +++ b/libcxx/test/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp @@ -18,6 +18,16 @@ #include <utility> #include <cassert> +#if __cplusplus > 201103L +struct S { + std::pair<int, int> a; + int k; + constexpr S() : a{1,2}, k(std::get<0>(a)) {} + }; + +constexpr std::pair<int, int> getP () { return { 3, 4 }; } +#endif + int main() { { @@ -30,4 +40,12 @@ int main() assert(std::get<0>(p) == 5); assert(std::get<1>(p) == 6); } + +#if __cplusplus > 201103L + { + static_assert(S().k == 1, ""); + static_assert(std::get<1>(getP()) == 4, ""); + } +#endif + } |