[cfe-commits] [libcxx] r132650 - in /libcxx/trunk: include/ test/containers/container.adaptors/priority.queue/priqueue.cons/ test/containers/container.adaptors/priority.queue/priqueue.special/ test/containers/container.adaptors/queue/queue.cons/ test/containers/container.adaptors/queue/queue.special/
Howard Hinnant
hhinnant at apple.com
Sat Jun 4 14:32:33 PDT 2011
Author: hhinnant
Date: Sat Jun 4 16:32:33 2011
New Revision: 132650
URL: http://llvm.org/viewvc/llvm-project?rev=132650&view=rev
Log:
noexcept for <queue>.
Added:
libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp
libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp
libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp
libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp
libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp
libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp
libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp
libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp
libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp
libcxx/trunk/test/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp
Modified:
libcxx/trunk/include/queue
Modified: libcxx/trunk/include/queue
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/queue?rev=132650&r1=132649&r2=132650&view=diff
==============================================================================
--- libcxx/trunk/include/queue (original)
+++ libcxx/trunk/include/queue Sat Jun 4 16:32:33 2011
@@ -31,10 +31,17 @@
container_type c;
public:
- queue();
+ queue() = default;
+ ~queue() = default;
+
+ queue(const queue& q) = default;
+ queue(queue&& q) = default;
+
+ queue& operator=(const queue& q) = default;
+ queue& operator=(queue&& q) = default;
+
explicit queue(const container_type& c);
- explicit queue(container_type&& c);
- queue(queue&& q);
+ explicit queue(container_type&& c)
template <class Alloc>
explicit queue(const Alloc& a);
template <class Alloc>
@@ -42,10 +49,10 @@
template <class Alloc>
queue(container_type&& c, const Alloc& a);
template <class Alloc>
+ queue(const queue& q, const Alloc& a);
+ template <class Alloc>
queue(queue&& q, const Alloc& a);
- queue& operator=(queue&& q);
-
bool empty() const;
size_type size() const;
@@ -59,7 +66,7 @@
template <class... Args> void emplace(Args&&... args);
void pop();
- void swap(queue& q);
+ void swap(queue& q) noexcept(noexcept(swap(c, q.c)));
};
template <class T, class Container>
@@ -81,7 +88,8 @@
bool operator<=(const queue<T, Container>& x,const queue<T, Container>& y);
template <class T, class Container>
- void swap(queue<T, Container>& x, queue<T, Container>& y);
+ void swap(queue<T, Container>& x, queue<T, Container>& y)
+ noexcept(noexcept(x.swap(y)));
template <class T, class Container = vector<T>,
class Compare = less<typename Container::value_type>>
@@ -99,7 +107,16 @@
Compare comp;
public:
- explicit priority_queue(const Compare& comp = Compare());
+ priority_queue() = default;
+ ~priority_queue() = default;
+
+ priority_queue(const priority_queue& q) = default;
+ priority_queue(priority_queue&& q) = default;
+
+ priority_queue& operator=(const priority_queue& q) = default;
+ priority_queue& operator=(priority_queue&& q) = default;
+
+ explicit priority_queue(const Compare& comp);
priority_queue(const Compare& comp, const container_type& c);
explicit priority_queue(const Compare& comp, container_type&& c);
template <class InputIterator>
@@ -111,8 +128,6 @@
template <class InputIterator>
priority_queue(InputIterator first, InputIterator last,
const Compare& comp, container_type&& c);
- priority_queue(priority_queue&& q);
- priority_queue& operator=(priority_queue&& q);
template <class Alloc>
explicit priority_queue(const Alloc& a);
template <class Alloc>
@@ -124,6 +139,8 @@
priority_queue(const Compare& comp, container_type&& c,
const Alloc& a);
template <class Alloc>
+ priority_queue(const priority_queue& q, const Alloc& a);
+ template <class Alloc>
priority_queue(priority_queue&& q, const Alloc& a);
bool empty() const;
@@ -135,12 +152,14 @@
template <class... Args> void emplace(Args&&... args);
void pop();
- void swap(priority_queue& q);
+ void swap(priority_queue& q)
+ noexcept(noexcept(swap(c, q.c)) && noexcept(swap(comp.q.comp)));
};
template <class T, class Container, class Compare>
void swap(priority_queue<T, Container, Compare>& x,
- priority_queue<T, Container, Compare>& y);
+ priority_queue<T, Container, Compare>& y)
+ noexcept(noexcept(x.swap(y)));
} // std
@@ -181,14 +200,35 @@
public:
_LIBCPP_INLINE_VISIBILITY
- queue() : c() {}
+ queue()
+ _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
+ : c() {}
+
+ _LIBCPP_INLINE_VISIBILITY
+ queue(const queue& __q) : c(__q.c) {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
+ queue(queue&& __q)
+ _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
+ : c(_STD::move(__q.c)) {}
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+ _LIBCPP_INLINE_VISIBILITY
+ queue& operator=(const queue& __q) {c = __q.c; return *this;}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
+ queue& operator=(queue&& __q)
+ _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
+ {c = _STD::move(__q.c); return *this;}
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
_LIBCPP_INLINE_VISIBILITY
explicit queue(const container_type& __c) : c(__c) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit queue(container_type&& __c) : c(_STD::move(__c)) {}
- _LIBCPP_INLINE_VISIBILITY
- queue(queue&& __q) : c(_STD::move(__q.c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
@@ -222,12 +262,6 @@
_Alloc>::value>::type* = 0)
: c(_STD::move(__q.c), __a) {}
- _LIBCPP_INLINE_VISIBILITY
- queue& operator=(queue&& __q)
- {
- c = _STD::move(__q.c);
- return *this;
- }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -261,6 +295,7 @@
_LIBCPP_INLINE_VISIBILITY
void swap(queue& __q)
+ _NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
{
using _STD::swap;
swap(c, __q.c);
@@ -331,6 +366,7 @@
inline _LIBCPP_INLINE_VISIBILITY
void
swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{
__x.swap(__y);
}
@@ -359,7 +395,36 @@
public:
_LIBCPP_INLINE_VISIBILITY
- explicit priority_queue(const value_compare& __comp = value_compare())
+ priority_queue()
+ _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value &&
+ is_nothrow_default_constructible<value_compare>::value)
+ : c(), comp() {}
+
+ _LIBCPP_INLINE_VISIBILITY
+ priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
+ priority_queue(priority_queue&& __q)
+ _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value &&
+ is_nothrow_move_constructible<value_compare>::value)
+ : c(_STD::move(__q.c)), comp(_STD::move(__q.comp)) {}
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+ _LIBCPP_INLINE_VISIBILITY
+ priority_queue& operator=(const priority_queue& __q)
+ {c = __q.c; comp = __q.comp; return *this;}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
+ priority_queue& operator=(priority_queue&& __q)
+ _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value &&
+ is_nothrow_move_assignable<value_compare>::value)
+ {c = _STD::move(__q.c); comp = _STD::move(__q.comp); return *this;}
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+ _LIBCPP_INLINE_VISIBILITY
+ explicit priority_queue(const value_compare& __comp)
: c(), comp(__comp) {}
priority_queue(const value_compare& __comp, const container_type& __c);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -375,8 +440,6 @@
template <class _InputIter>
priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp, container_type&& __c);
- priority_queue(priority_queue&& __q);
- priority_queue& operator=(priority_queue&& __q);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc>
explicit priority_queue(const _Alloc& __a,
@@ -423,7 +486,9 @@
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void pop();
- void swap(priority_queue& __q);
+ void swap(priority_queue& __q)
+ _NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
+ __is_nothrow_swappable<value_compare>::value);
};
template <class _Tp, class _Container, class _Compare>
@@ -489,23 +554,6 @@
_STD::make_heap(c.begin(), c.end(), comp);
}
-template <class _Tp, class _Container, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY
-priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q)
- : c(_STD::move(__q.c)),
- comp(_STD::move(__q.comp))
-{
-}
-
-template <class _Tp, class _Container, class _Compare>
-priority_queue<_Tp, _Container, _Compare>&
-priority_queue<_Tp, _Container, _Compare>::operator=(priority_queue&& __q)
-{
- c = _STD::move(__q.c);
- comp = _STD::move(__q.comp);
- return *this;
-}
-
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Container, class _Compare>
@@ -636,6 +684,8 @@
inline _LIBCPP_INLINE_VISIBILITY
void
priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
+ _NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
+ __is_nothrow_swappable<value_compare>::value)
{
using _STD::swap;
swap(c, __q.c);
@@ -647,6 +697,7 @@
void
swap(priority_queue<_Tp, _Container, _Compare>& __x,
priority_queue<_Tp, _Container, _Compare>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{
__x.swap(__y);
}
Added: libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp?rev=132650&view=auto
==============================================================================
--- libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp Sat Jun 4 16:32:33 2011
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue()
+// noexcept(is_nothrow_default_constructible<container_type>::value &&
+// is_nothrow_default_constructible<Compare>::value);
+
+// This tests a conforming extension
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+ {
+ typedef std::priority_queue<MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+#endif
+}
Added: libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp?rev=132650&view=auto
==============================================================================
--- libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp Sat Jun 4 16:32:33 2011
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// ~priority_queue() // implied noexcept;
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+ {
+ typedef std::priority_queue<MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+#endif
+}
Added: libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp?rev=132650&view=auto
==============================================================================
--- libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp Sat Jun 4 16:32:33 2011
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue& operator=(priority_queue&& c)
+// noexcept(is_nothrow_move_assignable<container_type>::value &&
+// is_nothrow_move_assignable<Compare>::value);
+
+// This tests a conforming extension
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+ {
+ typedef std::priority_queue<MoveOnly> C;
+ static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ }
+#endif
+}
Added: libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp?rev=132650&view=auto
==============================================================================
--- libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp Sat Jun 4 16:32:33 2011
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue(priority_queue&&)
+// noexcept(is_nothrow_move_constructible<container_type>::value &&
+// is_nothrow_move_constructible<Compare>::value);
+
+// This tests a conforming extension
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+ {
+ typedef std::priority_queue<MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+#endif
+}
Added: libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp?rev=132650&view=auto
==============================================================================
--- libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp Sat Jun 4 16:32:33 2011
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// void swap(priority_queue& c)
+// noexcept(__is_nothrow_swappable<container_type>::value &&
+// __is_nothrow_swappable<Compare>::value);
+
+// This tests a conforming extension
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+ {
+ typedef std::priority_queue<MoveOnly> C;
+ C c1, c2;
+ static_assert(noexcept(swap(c1, c2)), "");
+ }
+#endif
+}
Added: libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp?rev=132650&view=auto
==============================================================================
--- libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp Sat Jun 4 16:32:33 2011
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// queue()
+// noexcept(is_nothrow_default_constructible<container_type>::value);
+
+// This tests a conforming extension
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+ {
+ typedef std::queue<MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+#endif
+}
Added: libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp?rev=132650&view=auto
==============================================================================
--- libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp Sat Jun 4 16:32:33 2011
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// ~queue() // implied noexcept;
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+ {
+ typedef std::queue<MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+#endif
+}
Added: libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp?rev=132650&view=auto
==============================================================================
--- libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp Sat Jun 4 16:32:33 2011
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// queue& operator=(queue&& c)
+// noexcept(is_nothrow_move_assignable<container_type>::value);
+
+// This tests a conforming extension
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+ {
+ typedef std::queue<MoveOnly> C;
+ static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ }
+#endif
+}
Added: libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp?rev=132650&view=auto
==============================================================================
--- libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp Sat Jun 4 16:32:33 2011
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// queue(queue&&)
+// noexcept(is_nothrow_move_constructible<container_type>::value);
+
+// This tests a conforming extension
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+ {
+ typedef std::queue<MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+#endif
+}
Added: libcxx/trunk/test/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp?rev=132650&view=auto
==============================================================================
--- libcxx/trunk/test/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp Sat Jun 4 16:32:33 2011
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// void swap(queue& c)
+// noexcept(__is_nothrow_swappable<container_type>::value);
+
+// This tests a conforming extension
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+ {
+ typedef std::queue<MoveOnly> C;
+ C c1, c2;
+ static_assert(noexcept(swap(c1, c2)), "");
+ }
+#endif
+}
More information about the cfe-commits
mailing list