jupyter-xeus / xeus-cling

Jupyter kernel for the C++ programming language
BSD 3-Clause "New" or "Revised" License
3.08k stars 298 forks source link

Converting lambdas to std::function in cling #148

Open SylvainCorlay opened 6 years ago

SylvainCorlay commented 6 years ago

The following code is valid and compiles properly in cling, but not in the xeus-cling kernel, which crashes.

#include <functional>

std::function<void()> f = [](){};

In general, we have issues with converting lambdas to std::function when running in the C++ notebook, where the same code compiles fine with normal compilers.

SylvainCorlay commented 6 years ago

cc @vgvassilev who may know what is going on here.

SylvainCorlay commented 6 years ago

I suspect it comes from how we call the metaprocessor, to which we pass a Value unlike the usual cling user interface, and this function probably triggers a bug in that case.