[libcxx] r294995 - Add tests for noexcept functions
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 13 14:44:40 PST 2017
Author: ericwf
Date: Mon Feb 13 16:44:39 2017
New Revision: 294995
URL: http://llvm.org/viewvc/llvm-project?rev=294995&view=rev
Log:
Add tests for noexcept functions
Modified:
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp
Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp?rev=294995&r1=294994&r2=294995&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp Mon Feb 13 16:44:39 2017
@@ -13,6 +13,7 @@
#include <type_traits>
#include <cstddef> // for std::nullptr_t
+
#include "test_macros.h"
template <class T>
@@ -79,22 +80,27 @@ int main()
test_is_function<int(Abstract *)>();
test_is_function<void(...)>();
- test_is_not_function<std::nullptr_t>();
- test_is_not_function<void>();
- test_is_not_function<int>();
- test_is_not_function<int&>();
- test_is_not_function<int&&>();
- test_is_not_function<int*>();
- test_is_not_function<double>();
- test_is_not_function<char[3]>();
- test_is_not_function<char[]>();
- test_is_not_function<Union>();
- test_is_not_function<Enum>();
- test_is_not_function<FunctionPtr>(); // function pointer is not a function
- test_is_not_function<Empty>();
- test_is_not_function<bit_zero>();
- test_is_not_function<NotEmpty>();
- test_is_not_function<Abstract>();
- test_is_not_function<Abstract*>();
- test_is_not_function<incomplete_type>();
+ test_is_not_function<std::nullptr_t>();
+ test_is_not_function<void>();
+ test_is_not_function<int>();
+ test_is_not_function<int&>();
+ test_is_not_function<int&&>();
+ test_is_not_function<int*>();
+ test_is_not_function<double>();
+ test_is_not_function<char[3]>();
+ test_is_not_function<char[]>();
+ test_is_not_function<Union>();
+ test_is_not_function<Enum>();
+ test_is_not_function<FunctionPtr>(); // function pointer is not a function
+ test_is_not_function<Empty>();
+ test_is_not_function<bit_zero>();
+ test_is_not_function<NotEmpty>();
+ test_is_not_function<Abstract>();
+ test_is_not_function<Abstract*>();
+ test_is_not_function<incomplete_type>();
+
+#if TEST_STD_VER >= 11
+ test_is_function<void() noexcept>();
+ test_is_function<void() const && noexcept>();
+#endif
}
Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp?rev=294995&r1=294994&r2=294995&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp Mon Feb 13 16:44:39 2017
@@ -97,4 +97,10 @@ int main()
test_is_not_member_pointer<NotEmpty>();
test_is_not_member_pointer<Abstract>();
test_is_not_member_pointer<incomplete_type>();
+
+#if TEST_STD_VER >= 11
+ test_is_member_pointer<int (Empty::*)(int, ...) const>();
+ test_is_member_pointer<int (Empty::*)(int, long, long) const noexcept>();
+ test_is_member_pointer<int (Empty::*)() & noexcept>();
+#endif
}
Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp?rev=294995&r1=294994&r2=294995&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp Mon Feb 13 16:44:39 2017
@@ -52,90 +52,175 @@ struct incomplete_type;
int main()
{
- test_member_function_pointer<void (Class::*)()>();
- test_member_function_pointer<void (Class::*)(int)>();
- test_member_function_pointer<void (Class::*)(int, char)>();
-
- test_member_function_pointer<void (Class::*)() const>();
- test_member_function_pointer<void (Class::*)(int) const>();
- test_member_function_pointer<void (Class::*)(int, char) const>();
-
- test_member_function_pointer<void (Class::*)() volatile>();
- test_member_function_pointer<void (Class::*)(int) volatile>();
- test_member_function_pointer<void (Class::*)(int, char) volatile>();
-
- test_member_function_pointer<void (Class::*)(...)>();
- test_member_function_pointer<void (Class::*)(int, ...)>();
- test_member_function_pointer<void (Class::*)(int, char, ...)>();
-
- test_member_function_pointer<void (Class::*)(...) const>();
- test_member_function_pointer<void (Class::*)(int, ...) const>();
- test_member_function_pointer<void (Class::*)(int, char, ...) const>();
-
- test_member_function_pointer<void (Class::*)(...) volatile>();
- test_member_function_pointer<void (Class::*)(int, ...) volatile>();
- test_member_function_pointer<void (Class::*)(int, char, ...) volatile>();
+ test_member_function_pointer<void (Class::*)()>();
+ test_member_function_pointer<void (Class::*)(int)>();
+ test_member_function_pointer<void (Class::*)(int, char)>();
+
+ test_member_function_pointer<void (Class::*)() const>();
+ test_member_function_pointer<void (Class::*)(int) const>();
+ test_member_function_pointer<void (Class::*)(int, char) const>();
+
+ test_member_function_pointer<void (Class::*)() volatile>();
+ test_member_function_pointer<void (Class::*)(int) volatile>();
+ test_member_function_pointer<void (Class::*)(int, char) volatile>();
+
+ test_member_function_pointer<void (Class::*)(...)>();
+ test_member_function_pointer<void (Class::*)(int, ...)>();
+ test_member_function_pointer<void (Class::*)(int, char, ...)>();
+
+ test_member_function_pointer<void (Class::*)(...) const>();
+ test_member_function_pointer<void (Class::*)(int, ...) const>();
+ test_member_function_pointer<void (Class::*)(int, char, ...) const>();
+
+ test_member_function_pointer<void (Class::*)(...) volatile>();
+ test_member_function_pointer<void (Class::*)(int, ...) volatile>();
+ test_member_function_pointer<void (Class::*)(int, char, ...) volatile>();
+
// reference qualifiers on functions are a C++11 extension
#if TEST_STD_VER >= 11
- test_member_function_pointer<void (Class::*)() &>();
- test_member_function_pointer<void (Class::*)(int) &>();
- test_member_function_pointer<void (Class::*)(int, char) &>();
- test_member_function_pointer<void (Class::*)(...) &>();
- test_member_function_pointer<void (Class::*)(int,...) &>();
- test_member_function_pointer<void (Class::*)(int, char,...) &>();
-
- test_member_function_pointer<void (Class::*)() const &>();
- test_member_function_pointer<void (Class::*)(int) const &>();
- test_member_function_pointer<void (Class::*)(int, char) const &>();
- test_member_function_pointer<void (Class::*)(...) const &>();
- test_member_function_pointer<void (Class::*)(int,...) const &>();
- test_member_function_pointer<void (Class::*)(int, char,...) const &>();
-
- test_member_function_pointer<void (Class::*)() volatile &>();
- test_member_function_pointer<void (Class::*)(int) volatile &>();
- test_member_function_pointer<void (Class::*)(int, char) volatile &>();
- test_member_function_pointer<void (Class::*)(...) volatile &>();
- test_member_function_pointer<void (Class::*)(int,...) volatile &>();
- test_member_function_pointer<void (Class::*)(int, char,...) volatile &>();
-
- test_member_function_pointer<void (Class::*)() const volatile &>();
- test_member_function_pointer<void (Class::*)(int) const volatile &>();
- test_member_function_pointer<void (Class::*)(int, char) const volatile &>();
- test_member_function_pointer<void (Class::*)(...) const volatile &>();
- test_member_function_pointer<void (Class::*)(int,...) const volatile &>();
- test_member_function_pointer<void (Class::*)(int, char,...) const volatile &>();
-
- // RValue qualifiers
- test_member_function_pointer<void (Class::*)() &&>();
- test_member_function_pointer<void (Class::*)(int) &&>();
- test_member_function_pointer<void (Class::*)(int, char) &&>();
- test_member_function_pointer<void (Class::*)(...) &&>();
- test_member_function_pointer<void (Class::*)(int,...) &&>();
- test_member_function_pointer<void (Class::*)(int, char,...) &&>();
-
- test_member_function_pointer<void (Class::*)() const &&>();
- test_member_function_pointer<void (Class::*)(int) const &&>();
- test_member_function_pointer<void (Class::*)(int, char) const &&>();
- test_member_function_pointer<void (Class::*)(...) const &&>();
- test_member_function_pointer<void (Class::*)(int,...) const &&>();
- test_member_function_pointer<void (Class::*)(int, char,...) const &&>();
-
- test_member_function_pointer<void (Class::*)() volatile &&>();
- test_member_function_pointer<void (Class::*)(int) volatile &&>();
- test_member_function_pointer<void (Class::*)(int, char) volatile &&>();
- test_member_function_pointer<void (Class::*)(...) volatile &&>();
- test_member_function_pointer<void (Class::*)(int,...) volatile &&>();
- test_member_function_pointer<void (Class::*)(int, char,...) volatile &&>();
-
- test_member_function_pointer<void (Class::*)() const volatile &&>();
- test_member_function_pointer<void (Class::*)(int) const volatile &&>();
- test_member_function_pointer<void (Class::*)(int, char) const volatile &&>();
- test_member_function_pointer<void (Class::*)(...) const volatile &&>();
- test_member_function_pointer<void (Class::*)(int,...) const volatile &&>();
- test_member_function_pointer<void (Class::*)(int, char,...) const volatile &&>();
+ // Noexcept qualifiers
+ test_member_function_pointer<void (Class::*)() noexcept>();
+ test_member_function_pointer<void (Class::*)(int) noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char) noexcept>();
+
+ test_member_function_pointer<void (Class::*)() const noexcept>();
+ test_member_function_pointer<void (Class::*)(int) const noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char) const noexcept>();
+
+ test_member_function_pointer<void (Class::*)() volatile noexcept>();
+ test_member_function_pointer<void (Class::*)(int) volatile noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char) volatile noexcept>();
+
+ test_member_function_pointer<void (Class::*)(...) noexcept>();
+ test_member_function_pointer<void (Class::*)(int, ...) noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char, ...) noexcept>();
+
+ test_member_function_pointer<void (Class::*)(...) const noexcept>();
+ test_member_function_pointer<void (Class::*)(int, ...) const noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char, ...) const noexcept>();
+
+ test_member_function_pointer<void (Class::*)(...) volatile noexcept>();
+ test_member_function_pointer<void (Class::*)(int, ...) volatile noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char, ...) volatile noexcept>();
+
+ // lvalue qualifiers
+ test_member_function_pointer<void (Class::*)() &>();
+ test_member_function_pointer<void (Class::*)(int) &>();
+ test_member_function_pointer<void (Class::*)(int, char) &>();
+ test_member_function_pointer<void (Class::*)(...) &>();
+ test_member_function_pointer<void (Class::*)(int,...) &>();
+ test_member_function_pointer<void (Class::*)(int, char,...) &>();
+
+ test_member_function_pointer<void (Class::*)() const &>();
+ test_member_function_pointer<void (Class::*)(int) const &>();
+ test_member_function_pointer<void (Class::*)(int, char) const &>();
+ test_member_function_pointer<void (Class::*)(...) const &>();
+ test_member_function_pointer<void (Class::*)(int,...) const &>();
+ test_member_function_pointer<void (Class::*)(int, char,...) const &>();
+
+ test_member_function_pointer<void (Class::*)() volatile &>();
+ test_member_function_pointer<void (Class::*)(int) volatile &>();
+ test_member_function_pointer<void (Class::*)(int, char) volatile &>();
+ test_member_function_pointer<void (Class::*)(...) volatile &>();
+ test_member_function_pointer<void (Class::*)(int,...) volatile &>();
+ test_member_function_pointer<void (Class::*)(int, char,...) volatile &>();
+
+ test_member_function_pointer<void (Class::*)() const volatile &>();
+ test_member_function_pointer<void (Class::*)(int) const volatile &>();
+ test_member_function_pointer<void (Class::*)(int, char) const volatile &>();
+ test_member_function_pointer<void (Class::*)(...) const volatile &>();
+ test_member_function_pointer<void (Class::*)(int,...) const volatile &>();
+ test_member_function_pointer<void (Class::*)(int, char,...) const volatile &>();
+
+ // Lvalue qualifiers with noexcept
+ test_member_function_pointer<void (Class::*)() & noexcept>();
+ test_member_function_pointer<void (Class::*)(int) & noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char) & noexcept>();
+ test_member_function_pointer<void (Class::*)(...) & noexcept>();
+ test_member_function_pointer<void (Class::*)(int,...) & noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char,...) & noexcept>();
+
+ test_member_function_pointer<void (Class::*)() const & noexcept>();
+ test_member_function_pointer<void (Class::*)(int) const & noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char) const & noexcept>();
+ test_member_function_pointer<void (Class::*)(...) const & noexcept>();
+ test_member_function_pointer<void (Class::*)(int,...) const & noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char,...) const & noexcept>();
+
+ test_member_function_pointer<void (Class::*)() volatile & noexcept>();
+ test_member_function_pointer<void (Class::*)(int) volatile & noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char) volatile & noexcept>();
+ test_member_function_pointer<void (Class::*)(...) volatile & noexcept>();
+ test_member_function_pointer<void (Class::*)(int,...) volatile & noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char,...) volatile & noexcept>();
+
+ test_member_function_pointer<void (Class::*)() const volatile & noexcept>();
+ test_member_function_pointer<void (Class::*)(int) const volatile & noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char) const volatile & noexcept>();
+ test_member_function_pointer<void (Class::*)(...) const volatile & noexcept>();
+ test_member_function_pointer<void (Class::*)(int,...) const volatile & noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char,...) const volatile & noexcept>();
+
+ // RValue qualifiers
+ test_member_function_pointer<void (Class::*)() &&>();
+ test_member_function_pointer<void (Class::*)(int) &&>();
+ test_member_function_pointer<void (Class::*)(int, char) &&>();
+ test_member_function_pointer<void (Class::*)(...) &&>();
+ test_member_function_pointer<void (Class::*)(int,...) &&>();
+ test_member_function_pointer<void (Class::*)(int, char,...) &&>();
+
+ test_member_function_pointer<void (Class::*)() const &&>();
+ test_member_function_pointer<void (Class::*)(int) const &&>();
+ test_member_function_pointer<void (Class::*)(int, char) const &&>();
+ test_member_function_pointer<void (Class::*)(...) const &&>();
+ test_member_function_pointer<void (Class::*)(int,...) const &&>();
+ test_member_function_pointer<void (Class::*)(int, char,...) const &&>();
+
+ test_member_function_pointer<void (Class::*)() volatile &&>();
+ test_member_function_pointer<void (Class::*)(int) volatile &&>();
+ test_member_function_pointer<void (Class::*)(int, char) volatile &&>();
+ test_member_function_pointer<void (Class::*)(...) volatile &&>();
+ test_member_function_pointer<void (Class::*)(int,...) volatile &&>();
+ test_member_function_pointer<void (Class::*)(int, char,...) volatile &&>();
+
+ test_member_function_pointer<void (Class::*)() const volatile &&>();
+ test_member_function_pointer<void (Class::*)(int) const volatile &&>();
+ test_member_function_pointer<void (Class::*)(int, char) const volatile &&>();
+ test_member_function_pointer<void (Class::*)(...) const volatile &&>();
+ test_member_function_pointer<void (Class::*)(int,...) const volatile &&>();
+ test_member_function_pointer<void (Class::*)(int, char,...) const volatile &&>();
+
+ // RValue qualifiers with noexcept
+ test_member_function_pointer<void (Class::*)() && noexcept>();
+ test_member_function_pointer<void (Class::*)(int) && noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char) && noexcept>();
+ test_member_function_pointer<void (Class::*)(...) && noexcept>();
+ test_member_function_pointer<void (Class::*)(int,...) && noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char,...) && noexcept>();
+
+ test_member_function_pointer<void (Class::*)() const && noexcept>();
+ test_member_function_pointer<void (Class::*)(int) const && noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char) const && noexcept>();
+ test_member_function_pointer<void (Class::*)(...) const && noexcept>();
+ test_member_function_pointer<void (Class::*)(int,...) const && noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char,...) const && noexcept>();
+
+ test_member_function_pointer<void (Class::*)() volatile && noexcept>();
+ test_member_function_pointer<void (Class::*)(int) volatile && noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char) volatile && noexcept>();
+ test_member_function_pointer<void (Class::*)(...) volatile && noexcept>();
+ test_member_function_pointer<void (Class::*)(int,...) volatile && noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char,...) volatile && noexcept>();
+
+ test_member_function_pointer<void (Class::*)() const volatile && noexcept>();
+ test_member_function_pointer<void (Class::*)(int) const volatile && noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char) const volatile && noexcept>();
+ test_member_function_pointer<void (Class::*)(...) const volatile && noexcept>();
+ test_member_function_pointer<void (Class::*)(int,...) const volatile && noexcept>();
+ test_member_function_pointer<void (Class::*)(int, char,...) const volatile && noexcept>();
#endif
// LWG#2582
- static_assert(!std::is_member_function_pointer<incomplete_type>::value, "");
+ static_assert(!std::is_member_function_pointer<incomplete_type>::value, "");
}
More information about the cfe-commits
mailing list