lundi 3 avril 2017

Is std::function broken in recent Xcode?

The following runs correctly here:

#include <iostream>   
#include <functional>

int main(int argc, const char * argv[]) {

    std::cout << "running \n";

    std::function<void(float)> testFn;

    if (testFn){
        std::cout << "fn is callable";
    } else
        std::cout << "fn is not callable";

    testFn = [](auto f){ std::cout << f << "\n"; };

    if (testFn){
        std::cout << "fn is callable";
    } else
        std::cout << "fn is not callable";


    return 0;
}

However, the recent Xcode upgrade logs "running" and nothing else! The current Clang version is reported as:

Apple LLVM version 8.1.0 (clang-802.0.38) Target: x86_64-apple-darwin16.5.0

Am I missing something or did std::function somehow "break" ?

Aucun commentaire:

Enregistrer un commentaire