summaryrefslogtreecommitdiffstats
path: root/libcxx/test/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2010-09-05 01:14:30 +0000
committerHoward Hinnant <hhinnant@apple.com>2010-09-05 01:14:30 +0000
commitcbf93f39592428fc01f0c92196c6abf35dc4ed42 (patch)
tree97d12422d41120001132cdcafc2d442ce0ab86ed /libcxx/test/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp
parentf9e81f9acbdd07281775fcf8cfcdd2b6a218da19 (diff)
downloadbcm5719-llvm-cbf93f39592428fc01f0c92196c6abf35dc4ed42.tar.gz
bcm5719-llvm-cbf93f39592428fc01f0c92196c6abf35dc4ed42.zip
sync with N3126
llvm-svn: 113101
Diffstat (limited to 'libcxx/test/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp')
-rw-r--r--libcxx/test/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/libcxx/test/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp b/libcxx/test/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp
new file mode 100644
index 00000000000..e86e6c8119c
--- /dev/null
+++ b/libcxx/test/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. 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);
+}
OpenPOWER on IntegriCloud