vgvassilev / cling

The interactive C++ interpreter Cling
https://rawgit.com/vgvassilev/cling/master/www/index.html
Other
1.77k stars 102 forks source link

[cling 1.0~dev] IncrementalJIT error in c++20 mode #226

Open dimitry-ishenko opened 1 year ago

dimitry-ishenko commented 1 year ago

Describe the bug

When running cling in c++20 mode I get this:

root@laptop:~# cling -std=c++20

****************** CLING ******************
* Type C++ code and press enter to run it *
*             Type .q to exit             *
*******************************************
[cling]$ #include <regex>
[cling]$ std::regex re1{"x"};
[cling]$ std::regex re2{"y"};
[IncrementalJIT] addModule() failed: Duplicate definition of symbol '__const._ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPcSt6vectorIcSaIcEEEElcNS0_5__ops15_Iter_less_iterEEvT_T0_SA_T1_T2_.__cmp'
[cling]$ .q

Same example runs totally fine in c++17 mode:

root@laptop:~# cling -std=c++17

****************** CLING ******************
* Type C++ code and press enter to run it *
*             Type .q to exit             *
*******************************************
[cling]$ #include <regex>
[cling]$ std::regex re1{"x"};
[cling]$ std::regex re2{"y"};
[cling]$ .q

Cling 0.9 likewise works fine in c++17 mode.

Expected behavior

No error.

To Reproduce

See above.

Setup

Cling version: 1.0~dev (cling-patches-llvm13 branch) Operating system: Ubuntu 22.04 How you obtained Cling: compiled myself

vgvassilev commented 1 year ago

The new orc infrastructure is very rigorous when it comes to weak symbol redefinition. I will have to test this example with clang-repl as well.

We have been trying to mitigate this problem and perhaps I miss some recent patch.

cc: @hahnjo