[cling] A failed compilation unloads more decls than strictly neccesary
Describe the bug
A reverted transaction due to a failed compilation ends up removing decls / JITed symbols that should be left untouched.
Related issues: #6439, #7970, ROOT-10848, ROOT-6254, ROOT-8084, and ROOT-8245.
Expected behavior
Clean unload. Reverting a transaction should probably not touch template instantiations / emitted symbols that correspond to deserialized decls.
To Reproduce
root [1] foo.size()
ROOT_prompt_1:1:4: error: no member named 'size' in 'std::unique_ptr<std::__cxx11::basic_string<char>, std::default_delete<std::__cxx11::basic_string<char> > >'; did you mean to use '->' instead of '.'?
foo.size()
^
->
root [2] foo->size()
ROOT_prompt_2:1:4: error: member reference type 'std::unique_ptr<std::string>' (aka 'unique_ptr<basic_string<char> >') is not a pointer; did you mean to use '.'?
foo->size()
~~~^~
or
root [0] std::unique_ptr<TFile> foo{TFile::Open("foo.root", "RECREATE")};
root [1] foo.GetName()
ROOT_prompt_1:1:4: error: no member named 'GetName' in 'std::unique_ptr<TFile, std::default_delete<TFile> >'; did you mean to use '->' instead of '.'?
foo.GetName()
^
->
root [2] foo->GetName()
IncrementalExecutor::executeFunction: symbol '_ZSt3getILm0EJP5TFileSt14default_deleteIS0_EEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS8_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::tuple_element<0ul, std::tuple<TFile*, std::default_delete<TFile> > >::type const& std::get<0ul, TFile*, std::default_delete<TFile> >(std::tuple<TFile*, std::default_delete<TFile> > const&)
Maybe you need to load the corresponding shared library?
Setup
ROOT master, Arch Linux x86_64
Hi @jalopezg-git,
It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.
Sincerely, :robot:
Hi @jalopezg-git,
It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.
Sincerely, :robot:
Unfortunately the second reproducer still fails for me in master - probably because of my last commit to make the tests pass on macOS :neutral_face:
I re-tested master. What I could see is that the reproducer still fails on linux but works fine on macos. I could also add that on lxplus with a large installation such as CMSSW or a LCG release the error needs several seconds to appear. Adding more eyes to the ticket...
I'm not able to reproduce the second example in the current master branch: