Commit 4cbe2abcc04ba91e4c26d0647187a08797098667
1 parent
39bfa013
Test empty function detection
Showing
1 changed file
with
6 additions
and
0 deletions
libtests/cxx11.cc
| ... | ... | @@ -48,6 +48,12 @@ void do_functional() |
| 48 | 48 | }; |
| 49 | 49 | |
| 50 | 50 | assert(make_addr_lambda(6)(8) == 14); |
| 51 | + | |
| 52 | + // nullptr and {} are empty functions | |
| 53 | + std::function<void()> f1 = {}; | |
| 54 | + assert(! f1); | |
| 55 | + std::function<void()> f2 = nullptr; | |
| 56 | + assert(! f2); | |
| 51 | 57 | } |
| 52 | 58 | |
| 53 | 59 | // Integer types, type traits | ... | ... |