jupyter-xeus/xeus

Building xeus failed with Visual Studio 2019 due to implicit conversion failed

LilyWangL opened this issue · 3 comments

When I build xeus with Visual Studio 2019, it built failed and I got this error:

xeus\src\ee70dfa02b-e9875865ca\src\xkernel_configuration.cpp(28): error C2593: 'operator =' is ambiguous
xeus\src\ee70dfa02b-e9875865ca\src\xkernel_configuration.cpp(29): error C2593: 'operator =' is ambiguous
xeus\src\ee70dfa02b-e9875865ca\src\xkernel_configuration.cpp(38): error C2593: 'operator =' is ambiguous

This is source code in xkernel_configuration.cpp:

        std::ifstream ifs(file_name);

        nl::json doc;
        ifs >> doc;

        xconfiguration res;
        res.m_transport = doc["transport"];
        res.m_ip = doc["ip"];
        res.m_control_port = std::to_string(doc["control_port"].get<int>());
        res.m_shell_port = std::to_string(doc["shell_port"].get<int>());
        res.m_stdin_port = std::to_string(doc["stdin_port"].get<int>());
        res.m_iopub_port = std::to_string(doc["iopub_port"].get<int>());
        res.m_hb_port = std::to_string(doc["hb_port"].get<int>());
        res.m_signature_scheme = doc.value("signature_scheme", "");
        if (res.m_signature_scheme != "")
        {
            res.m_key = doc["key"];
        }
        else
        {
            res.m_key = "";
        }

The type of res.m_transport is string. When converting nl::json doc to string, it failed. I try to modify doc["transport"] to doc["transport"].get<std::string>(), it build successfully. But I don't know this change is correct or not. Who can help me to confirm it?

Thanks.

Thanks for reporting and opening a PR. This looks like a (yet another) MSVC compiler bug.

I will comment on the PR.

Hey @LilyWangL a PR to xeus core applying the same patch would be very welcome.

Would you be fine with opening one (and enabling VS 2019 in the build matrix?)

This is now fixed in 0.23.3. Closing.