Strange result of compilation: experimental/string_view


I am not sure if it is ROOT/CLING or GCC problem, or I am doing something wrong… Here is the code, which reproduces it:

// root.exe -l string_view.C+
#include <experimental/string_view>
void string_view(void) {}

and here is output:

$ root.exe -l string_view.C+
root [0]
Processing string_view.C+…
Info in TUnixSystem::ACLiC: creating shared library …/
In file included from …/CentOS7.2/gcc-6.3.0/include/c++/6.3.0/experimental/string_view:43:0,
from …/CentOS7.2/root-6.09.02/include/RStringView.h:24,
from …/CentOS7.2/root-6.09.02/include/TString.h:28,
from …/CentOS7.2/root-6.09.02/include/TNamed.h:26,
from …/CentOS7.2/root-6.09.02/include/TDictionary.h:44,
from …/CentOS7.2/root-6.09.02/include/TClass.h:24,
from …/string_view_C_ACLiC_dict.cxx:13:
…/CentOS7.2/gcc-6.3.0/include/c++/6.3.0/limits:1598:7: internal compiler error: Illegal instruction
0xac73ff crash_signal
0xa3cb5d real_from_string(real_value*, char const*)
0xa3d5ab real_from_string3(real_value*, char const*, format_helper)
0x73c69a interpret_float
0x73d45e c_lex_with_flags(tree_node**, unsigned int*, unsigned char*, int)
0x645efe cp_lexer_get_preprocessor_token
0x67612d cp_lexer_new_main
0x67612d cp_parser_new
0x67612d c_parse_file()
0x742cf2 c_common_parse_file()
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See for instructions.
g++: error: …/string_view_C_ACLiC_dict.o: No such file or directory
Error in : Compilation failed!

Please, let me know if you have any idea.


on osx I get

input_line_10:2:2: error: reference to 'string_view' is ambiguous
././string_view.C:2:6: note: candidate found by name lookup is 'string_view'
void string_view(void) {}
.... RStringView.h:35:36: note: candidate found by name lookup is 'std::string_view'
   typedef basic_string_view<char> string_view;

the name is indeed ambiguous. If you change the macro name and function name, for example to mytest.C it works just fine.


That’s not completely the same; we have a using namespace std on the prompt but not in rootcling / when invoking ACLiC. I’ll investigate on Monday…


I am not sure what happened, but the indication is that it is some side effect of having ROOT compiled on one machine (M1), and then recompiling the compiler on another (M2), and then running ROOT on M1 (with the updated compiler). If I run ROOT on M2 instead, then the problem does not appear. It seems CLING or something else is picky about some small machine dependent changes in the compiler (i.e. it does matter on which machine compiler used by ROOT was compiled). The compiler version was 100% identical on both machines, and it was the same compiler, which was used to compile ROOT.

Thanks - then it’ll be hard for us to reproduce. In general these things happen if something throws a using namespace std into the global scope - as we intentionally do on the prompt, but only on the prompt.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.