Having multiple `using namespace` statements in one Jupyter cell doesn't work properly
ianholst opened this issue · 1 comments
To Reproduce
I'm using the Jupyter kernel included in Cling, not xeus-cling. For example, run in the first cell:
#include <iostream>
#include <chrono>
using namespace std;
using namespace std::chrono;
Then in the second cell, I access something from the second namespace, std::chrono
:
system_clock c;
I would expect this to successfully declare the variable and give no output, but instead Cling gives an error indicating that the std::chrono
namespace has not been made available:
input_line_4:2:2: error: unknown type name 'system_clock'; did you mean 'std::chrono::system_clock'?
system_clock c;
^~~~~~~~~~~~
std::chrono::system_clock
/usr/include/c++/11/chrono:1125:12: note: 'std::chrono::system_clock' declared here
struct system_clock
^
ename: evalue
This same code works fine in the Cling command line interpreter, where things are not split up into cells.
I know that the first using namespace
worked, since I can use just cout << "test";
with no problem in later cells. Doing more tests (with code other than the C++ standard library), it looks like only the first using namespace
is processed correctly by Cling, and all later ones in the same cell are ignored.
Setup
- Cling version 0.9
- Operating system: Ubuntu 22.04
- I built Cling myself from source.