This issue was identified during a Codex code review.
Constructing cl::function from a null function pointer or null member-function pointer currently creates an apparently non-empty function. Invoking it then results in undefined behavior instead of throwing std::bad_function_call.
Empty std::function targets also remain wrapped as apparently non-empty objects.
Normalize supported null and empty callable targets to the empty cl::function state and add regression tests.
This issue was identified during a Codex code review.
Constructing
cl::functionfrom a null function pointer or null member-function pointer currently creates an apparently non-empty function. Invoking it then results in undefined behavior instead of throwingstd::bad_function_call.Empty
std::functiontargets also remain wrapped as apparently non-empty objects.Normalize supported null and empty callable targets to the empty
cl::functionstate and add regression tests.