aboutsummaryrefslogtreecommitdiff
path: root/test/std/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp')
-rw-r--r--test/std/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/std/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp b/test/std/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp
new file mode 100644
index 000000000000..8e43d05fc682
--- /dev/null
+++ b/test/std/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// const_reference top() const;
+
+#include <stack>
+#include <cassert>
+
+int main()
+{
+ std::stack<int> q;
+ assert(q.size() == 0);
+ q.push(1);
+ q.push(2);
+ q.push(3);
+ const std::stack<int>& cqr = q;
+ const int& cir = cqr.top();
+ assert(cir == 3);
+}