mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-23 18:38:30 +08:00
Add tests for noexcept functions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294995 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <cstddef> // for std::nullptr_t
|
#include <cstddef> // for std::nullptr_t
|
||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@@ -97,4 +98,9 @@ int main()
|
|||||||
test_is_not_function<Abstract>();
|
test_is_not_function<Abstract>();
|
||||||
test_is_not_function<Abstract*>();
|
test_is_not_function<Abstract*>();
|
||||||
test_is_not_function<incomplete_type>();
|
test_is_not_function<incomplete_type>();
|
||||||
|
|
||||||
|
#if TEST_STD_VER >= 11
|
||||||
|
test_is_function<void() noexcept>();
|
||||||
|
test_is_function<void() const && noexcept>();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -97,4 +97,10 @@ int main()
|
|||||||
test_is_not_member_pointer<NotEmpty>();
|
test_is_not_member_pointer<NotEmpty>();
|
||||||
test_is_not_member_pointer<Abstract>();
|
test_is_not_member_pointer<Abstract>();
|
||||||
test_is_not_member_pointer<incomplete_type>();
|
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
|
||||||
}
|
}
|
||||||
|
@@ -76,8 +76,35 @@ int main()
|
|||||||
test_member_function_pointer<void (Class::*)(int, ...) volatile>();
|
test_member_function_pointer<void (Class::*)(int, ...) volatile>();
|
||||||
test_member_function_pointer<void (Class::*)(int, char, ...) volatile>();
|
test_member_function_pointer<void (Class::*)(int, char, ...) volatile>();
|
||||||
|
|
||||||
|
|
||||||
// reference qualifiers on functions are a C++11 extension
|
// reference qualifiers on functions are a C++11 extension
|
||||||
#if TEST_STD_VER >= 11
|
#if TEST_STD_VER >= 11
|
||||||
|
// 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::*)() &>();
|
||||||
test_member_function_pointer<void (Class::*)(int) &>();
|
test_member_function_pointer<void (Class::*)(int) &>();
|
||||||
test_member_function_pointer<void (Class::*)(int, char) &>();
|
test_member_function_pointer<void (Class::*)(int, char) &>();
|
||||||
@@ -106,6 +133,35 @@ int main()
|
|||||||
test_member_function_pointer<void (Class::*)(int,...) 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::*)(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
|
// RValue qualifiers
|
||||||
test_member_function_pointer<void (Class::*)() &&>();
|
test_member_function_pointer<void (Class::*)() &&>();
|
||||||
test_member_function_pointer<void (Class::*)(int) &&>();
|
test_member_function_pointer<void (Class::*)(int) &&>();
|
||||||
@@ -134,6 +190,35 @@ int main()
|
|||||||
test_member_function_pointer<void (Class::*)(...) 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,...) const volatile &&>();
|
||||||
test_member_function_pointer<void (Class::*)(int, char,...) 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
|
#endif
|
||||||
|
|
||||||
// LWG#2582
|
// LWG#2582
|
||||||
|
Reference in New Issue
Block a user