From 4cbe2abcc04ba91e4c26d0647187a08797098667 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Fri, 25 Dec 2020 06:51:45 -0500 Subject: [PATCH] Test empty function detection --- libtests/cxx11.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libtests/cxx11.cc b/libtests/cxx11.cc index ba4525ed..bec86cec 100644 --- a/libtests/cxx11.cc +++ b/libtests/cxx11.cc @@ -48,6 +48,12 @@ void do_functional() }; assert(make_addr_lambda(6)(8) == 14); + + // nullptr and {} are empty functions + std::function f1 = {}; + assert(! f1); + std::function f2 = nullptr; + assert(! f2); } // Integer types, type traits