summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/any
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-10-16 11:56:38 +0000
committerEric Fiselier <eric@efcs.ca>2016-10-16 11:56:38 +0000
commitc5777f4d580a37f073b0351de26711d789433486 (patch)
tree3fb1d113fe4603a2540354ddbd08f14f3b8cc011 /libcxx/test/std/utilities/any
parent778269dd7840cc16478bf69788695da9add705d6 (diff)
downloadbcm5719-llvm-c5777f4d580a37f073b0351de26711d789433486.tar.gz
bcm5719-llvm-c5777f4d580a37f073b0351de26711d789433486.zip
Make any_cast<void()>(nullptr) compile
llvm-svn: 284333
Diffstat (limited to 'libcxx/test/std/utilities/any')
-rw-r--r--libcxx/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp b/libcxx/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
index 0f4fc6ab7eb..1a5a85482b8 100644
--- a/libcxx/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
+++ b/libcxx/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
@@ -147,6 +147,18 @@ void test_cast_non_copyable_type()
assert(std::any_cast<NoCopy>(&ca) == nullptr);
}
+void test_fn() {}
+
+void test_cast_function_pointer() {
+ using T = void(*)();
+ std::any a(test_fn);
+ // An any can never store a function type, but we should at least be able
+ // to ask.
+ assert(std::any_cast<void()>(&a) == nullptr);
+ T fn_ptr = std::any_cast<T>(a);
+ assert(fn_ptr == test_fn);
+}
+
int main() {
test_cast_is_noexcept();
test_cast_return_type();
@@ -155,4 +167,5 @@ int main() {
test_cast<small>();
test_cast<large>();
test_cast_non_copyable_type();
+ test_cast_function_pointer();
}
OpenPOWER on IntegriCloud