Strange result of compilation: experimental/string_view

Hello,

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 …/string_view_C.so
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
min() _GLIBCXX_USE_NOEXCEPT { return FLT_MIN; }
^~~
0xac73ff crash_signal
…/CentOS7.2/gcc-6.3.0.source/gcc/toplev.c:333
0xa3cb5d real_from_string(real_value*, char const*)
…/CentOS7.2/gcc-6.3.0.source/gcc/real.c:2107
0xa3d5ab real_from_string3(real_value*, char const*, format_helper)
…/CentOS7.2/gcc-6.3.0.source/gcc/real.c:2173
0x73c69a interpret_float
…/CentOS7.2/gcc-6.3.0.source/gcc/c-family/c-lex.c:882
0x73d45e c_lex_with_flags(tree_node**, unsigned int*, unsigned char*, int)
…/CentOS7.2/gcc-6.3.0.source/gcc/c-family/c-lex.c:425
0x645efe cp_lexer_get_preprocessor_token
…/CentOS7.2/gcc-6.3.0.source/gcc/cp/parser.c:792
0x67612d cp_lexer_new_main
…/CentOS7.2/gcc-6.3.0.source/gcc/cp/parser.c:656
0x67612d cp_parser_new
…/CentOS7.2/gcc-6.3.0.source/gcc/cp/parser.c:3689
0x67612d c_parse_file()
…/CentOS7.2/gcc-6.3.0.source/gcc/cp/parser.c:37538
0x742cf2 c_common_parse_file()
…/CentOS7.2/gcc-6.3.0.source/gcc/c-family/c-opts.c:1064
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See http://gcc.gnu.org/bugs.html 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.

Hi,

on osx I get

input_line_10:2:2: error: reference to 'string_view' is ambiguous
 string_view()
 ^
././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.

Cheers,
D

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…

Axel.

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.

Axel.

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