summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2017-01-24 23:09:12 +0000
committerMarshall Clow <mclow.lists@gmail.com>2017-01-24 23:09:12 +0000
commit63b560be69c0660b427efe903689f410e1f02967 (patch)
tree0f5df4aa86b5886bb710a1465dd2f1a81e24ac8b /libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
parentb10fb96541bc45aea71c8652bb1786899826f7ad (diff)
downloadbcm5719-llvm-63b560be69c0660b427efe903689f410e1f02967.tar.gz
bcm5719-llvm-63b560be69c0660b427efe903689f410e1f02967.zip
Change the return type of emplace_[front|back] back to void when building with C++14 or before. Resolves PR31680.
llvm-svn: 292990
Diffstat (limited to 'libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp')
-rw-r--r--libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
index 77d822a0794..4142bc3694d 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
@@ -12,25 +12,35 @@
// <queue>
// template <class... Args> reference emplace(Args&&... args);
+// return type is 'reference' in C++17; 'void' before
+
#include <queue>
#include <cassert>
+#include "test_macros.h"
+
#include "../../../Emplaceable.h"
int main()
{
typedef Emplaceable T;
std::queue<Emplaceable> q;
+#if TEST_STD_VER > 14
T& r1 = q.emplace(1, 2.5);
assert(&r1 == &q.back());
T& r2 = q.emplace(2, 3.5);
assert(&r2 == &q.back());
T& r3 = q.emplace(3, 4.5);
assert(&r3 == &q.back());
+ assert(&r1 == &q.front());
+#else
+ q.emplace(1, 2.5);
+ q.emplace(2, 3.5);
+ q.emplace(3, 4.5);
+#endif
+
assert(q.size() == 3);
assert(q.front() == Emplaceable(1, 2.5));
assert(q.back() == Emplaceable(3, 4.5));
- assert(&r3 == &q.back());
- assert(&r1 == &q.front());
}
OpenPOWER on IntegriCloud