cling icon indicating copy to clipboard operation
cling copied to clipboard

process with `disableValuePrinting` set to true

Open gouarin opened this issue 6 years ago • 2 comments

In https://github.com/QuantStack/xeus-cling, we changed a little bit the way to process the input given in a cell notebook in order to write the output cleanly. To do that, we use the flag disableValuePrinting in the process method of the MetaProcessor and we found a bug.

Here is a simple example which illustrates the issue in the cling interpreter

#include <iostream>
#include "cling/Interpreter/Value.h"
#include "cling/Utils/Output.h"
#include "cling/MetaProcessor/MetaProcessor.h"

cling::MetaProcessor processor(*gCling, cling::errs());
cling::Value output;
cling::Interpreter::CompilationResult compilation_result;

std::string myinput{R"(auto test = [](auto i){std::cout << i << "\n";};)"};

processor.process(myinput, compilation_result, &output, true);
test(5)

The error message is

input_line_13:2:2: error: type '(lambda at input_line_12:2:14)' does not provide a call operator
 test(5)

Note that if you add a semicolon at the end of the myinput string, the problem is solved.

std::string myinput{R"(auto test = [](auto i){std::cout << i << "\n";};;)"};

It's a critical issue for xeus-cling and we hope that you can fix it soon in order to add a patch in your build process.

gouarin avatar May 22 '18 07:05 gouarin

Subscribing!

SylvainCorlay avatar May 22 '18 14:05 SylvainCorlay

I will take a look.

vgvassilev avatar May 22 '18 14:05 vgvassilev