This fixes a surprising behavior where changing an existing function_ref
to std::function can break some code in a subtle manner. Here is the
pattern:
void foo(llvm::function_ref<void()) callback) { if (callback) callback(); } void bar(llvm::function_ref<void()) callback) { foo(callback); // do something else with callback, accept an empty callback. }
Assuming bar needs to change to take a std::function (for example
to be able to store it), the code in foo() would crash if callback
is a default constructed function.
Instead of exposing this as an extra c'tor template parameter, would it make sense to split this out?
and then, on line 66: