Skip to content

cling goes into strange state after raising error about missing std:: #161

@nthiery

Description

@nthiery

The following snippet rightfully triggers an error in cling:

    #include <string>
    string s

However, cling goes into a weird state where it does not accept anymore:

    std::string s

I am using cling installed from QuantStack's conda repository:

/opt/miniconda3/bin/cling --version
0.4~dev

Full trace:

****************** CLING ******************
* Type C++ code and press enter to run it *
*             Type .q to exit             *
*******************************************
[cling]$ #include <string>
[cling]$ string s
input_line_4:2:2: error: unknown type name 'string'; did you mean 'std::string'?
 string s
 ^~~~~~
 std::string
/opt/miniconda3/gcc/include/c++/bits/stringfwd.h:74:33: note: 'std::string' declared here
  typedef basic_string<char>    string;   
                                ^

[cling]$ std::string s
input_line_5:2:14: error: no matching constructor for initialization of 'std::string' (aka 'basic_string<char>')
 std::string s
             ^
/opt/miniconda3/gcc/include/c++/bits/basic_string.h:549:9: note: candidate constructor template not viable: requires at least 2 arguments, but 0 were provided
        basic_string(_InputIterator __beg, _InputIterator __end,
        ^
/opt/miniconda3/gcc/include/c++/bits/basic_string.h:389:7: note: candidate constructor not viable: requires single argument '__a', but no arguments were provided
      basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT
      ^
/opt/miniconda3/gcc/include/c++/bits/basic_string.h:397:7: note: candidate constructor not viable: requires single argument '__str', but no arguments were provided
      basic_string(const basic_string& __str)
      ^
/opt/miniconda3/gcc/include/c++/bits/basic_string.h:476:7: note: candidate constructor not viable: requires single argument '__str', but no arguments were provided
      basic_string(basic_string&& __str) noexcept
      ^
/opt/miniconda3/gcc/include/c++/bits/basic_string.h:454:7: note: candidate constructor not viable: requires at least argument '__s', but no arguments were provided
      basic_string(const _CharT* __s, const _Alloc& __a = _Alloc())
      ^
/opt/miniconda3/gcc/include/c++/bits/basic_string.h:503:7: note: candidate constructor not viable: requires at least argument '__l', but no arguments were provided
      basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc())
      ^
/opt/miniconda3/gcc/include/c++/bits/basic_string.h:507:7: note: candidate constructor not viable: requires 2 arguments, but 0 were provided
      basic_string(const basic_string& __str, const _Alloc& __a)
      ^
/opt/miniconda3/gcc/include/c++/bits/basic_string.h:511:7: note: candidate constructor not viable: requires 2 arguments, but 0 were provided
      basic_string(basic_string&& __str, const _Alloc& __a)
      ^
/opt/miniconda3/gcc/include/c++/bits/basic_string.h:410:7: note: candidate constructor not viable: requires at least 2 arguments, but 0 were provided
      basic_string(const basic_string& __str, size_type __pos,
      ^
/opt/miniconda3/gcc/include/c++/bits/basic_string.h:444:7: note: candidate constructor not viable: requires at least 2 arguments, but 0 were provided
      basic_string(const _CharT* __s, size_type __n,
      ^
/opt/miniconda3/gcc/include/c++/bits/basic_string.h:464:7: note: candidate constructor not viable: requires at least 2 arguments, but 0 were provided
      basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc())
      ^
/opt/miniconda3/gcc/include/c++/bits/basic_string.h:426:7: note: candidate constructor not viable: requires 4 arguments, but 0 were provided
      basic_string(const basic_string& __str, size_type __pos,
      ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions