Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nthiery opened this issue Sep 4, 2017 · 3 comments
Open

Comments

@nthiery
Copy link

nthiery commented Sep 4, 2017

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,
      ^
@permotion88
Copy link

permotion88 commented Aug 24, 2018

I got the same error...

I have used cling 0.6~dev on Ubuntu.

@rsrini7
Copy link

rsrini7 commented Jan 14, 2019

Similar problem in my WSL
Linux MSI 4.4.0-17134-Microsoft #523-Microsoft Mon Dec 31 17:49:00 PST 2018 x86_64 GNU/Linux

[cling]$ #include <iostream>
[cling]$ using namespace std;
[cling]$ cout << "srini hi";
In file included from input_line_3:1:
In file included from /usr/include/c++/8/iostream:39:
/usr/include/c++/8/ostream:559:8: error: no member named 'setstate' in 'std::basic_ostream'
__out.setstate(ios_base::badbit);
~~~~~ ^
input_line_6:2:7: note: in instantiation of function template specialization 'std::operator<<<std::char_traits >' requested here
cout << "srini hi";
^

@derofim
Copy link

derofim commented Aug 17, 2019

issue may be in cling::Interpreter::unload function. It unloads headers without ability to auto-load them again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants