diff options
| author | Eric Fiselier <eric@efcs.ca> | 2017-05-07 21:15:28 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2017-05-07 21:15:28 +0000 |
| commit | fc353da22e135e65df6be4d8e2183828fc6b9220 (patch) | |
| tree | 192f3f850ed6c9813e8dc83d52ab98ba1eb9715b /libcxx | |
| parent | 17f01968f118eb2a42697c8706b0982a8a605794 (diff) | |
| download | bcm5719-llvm-fc353da22e135e65df6be4d8e2183828fc6b9220.tar.gz bcm5719-llvm-fc353da22e135e65df6be4d8e2183828fc6b9220.zip | |
Fix two test failures caused by Windows mangling of function types.
On Windows the function template `template <class T> void test()` has
the same mangled name when instantiated with the distinct types `void()`
and `void() noexcept`. When this occurs Clang emits an error. This error
was causing two type-traits tests to fail.
However this can be worked around by using class templates instead of
function templates, which is what this patch does to fix the errors.
llvm-svn: 302380
Diffstat (limited to 'libcxx')
| -rw-r--r-- | libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp | 15 | ||||
| -rw-r--r-- | libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp | 21 |
2 files changed, 21 insertions, 15 deletions
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp index c340ba69cda..4e875fa9452 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp @@ -16,9 +16,13 @@ #include "test_macros.h" +// NOTE: On Windows the function `test_is_function<void()>` and +// `test_is_function<void() noexcept> has the same mangled despite being +// a distinct instantiation. This causes Clang to emit an error. However +// structs do not have this problem. + template <class T> -void test_is_function() -{ +struct test_is_function { static_assert( std::is_function<T>::value, ""); static_assert( std::is_function<const T>::value, ""); static_assert( std::is_function<volatile T>::value, ""); @@ -29,11 +33,10 @@ void test_is_function() static_assert( std::is_function_v<volatile T>, ""); static_assert( std::is_function_v<const volatile T>, ""); #endif -} +}; template <class T> -void test_is_not_function() -{ +struct test_is_not_function { static_assert(!std::is_function<T>::value, ""); static_assert(!std::is_function<const T>::value, ""); static_assert(!std::is_function<volatile T>::value, ""); @@ -44,7 +47,7 @@ void test_is_not_function() static_assert(!std::is_function_v<volatile T>, ""); static_assert(!std::is_function_v<const volatile T>, ""); #endif -} +}; class Empty { diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp index 691c549b5e7..f685d71eebd 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp @@ -14,9 +14,12 @@ #include <type_traits> #include "test_macros.h" +// NOTE: On Windows the function `test_is_member_function<void()>` and +// `test_is_member_function<void() noexcept> has the same mangled despite being +// a distinct instantiation. This causes Clang to emit an error. However +// structs do not have this problem. template <class T> -void test_member_function_pointer_imp() -{ +struct test_member_function_pointer_imp { static_assert(!std::is_void<T>::value, ""); #if TEST_STD_VER > 11 static_assert(!std::is_null_pointer<T>::value, ""); @@ -33,16 +36,16 @@ void test_member_function_pointer_imp() static_assert(!std::is_union<T>::value, ""); static_assert(!std::is_class<T>::value, ""); static_assert(!std::is_function<T>::value, ""); -} +}; template <class T> -void test_member_function_pointer() +struct test_member_function_pointer : + test_member_function_pointer_imp<T>, + test_member_function_pointer_imp<const T>, + test_member_function_pointer_imp<volatile T>, + test_member_function_pointer_imp<const volatile T> { - test_member_function_pointer_imp<T>(); - test_member_function_pointer_imp<const T>(); - test_member_function_pointer_imp<volatile T>(); - test_member_function_pointer_imp<const volatile T>(); -} +}; class Class { |

