-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Implicit assignment to std::string fails #144
Comments
Thanks for reporting! I'll check the issue soon. |
Unfortunately, I cannot reproduce the error with GCC or Clang. As I have no access to MSVC, I cannot dig deeper into the error. Do you have any idea what the reason could be that MSVC rejects the code? |
I couldn't really find the reason. I'll check again in a bit. |
I am not using a Windows system, so trying MSVC is still difficult :-) |
I can confirm this issue with MSVC 2015. The workaround with |
Why? |
I am unable to debug MSVC error messages. If you have any idea how to fix it, I would be happy. |
The problem is that |
GCC 5.3.0 on linux produces similar error. Need to use explicit conversion. |
Clang 3.7 also reports the error. |
I fixed the code (see 457bfc2) and added test cases. The code compiles for GCC and Clang, but AppVeyor (https://ci.appveyor.com/project/nlohmann/json) fails to compile the code with MSVC. Does anyone have an idea what could be the issue? |
@nlohmann : I checked out master with a VM, and get the same issue on Master, so I would say that the issue is NOT with the proposed patch, but with master itself. |
The patch is on master, I believe. |
Thanks! |
Hey there, it seems the issue is cropping up for me again. I am trying to compile the same project on GCC and on Clang (built from current trunk), and the unit test compilation is failing for issue 144: /XXX/project-zero/thomasdullien/XXX/json-src/test/src/unit-regression.cpp:250:12: error: What's the best way to help fixing this? :) (btw, big fan of your library) |
That is strange, because this regression test is run with every commit on AppVeyor, see https://ci.appveyor.com/project/nlohmann/json/history. Edit: Of course, I meant Travis, see https://travis-ci.org/nlohmann/json/branches |
Maybe it's a C++17 thing? The "self view" sounds a bit like the new string view. |
Hey there,
so I downgraded to Clang 3.5, and it all works. I think we should not worry
about it for now - it may be a transitory issue
caused by me using trunk clang.
Cheers,
Thomas
2016-12-16 9:59 GMT+01:00 Jared Grubb <[email protected]>:
… Maybe it's a C++17 thing? The "self view" sounds a bit like the new string
view.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#144 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AEYBvBlDVClNhTaBZ6FhWtHvVLBm-9RAks5rIlLmgaJpZM4GZ3Rq>
.
|
Put simply, when constructing a string, you can pass a basic_json:
However, this does not work:
The following compiler errors pop up:
1>g:\files\smoldy_adventure\src\client\units\unitmgr.cpp(53): error C2593: 'operator =' is ambiguous
1> g:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring(1032): note: could be 'std::basic_string<char,std::char_traits,std::allocator> &std::basic_string<char,std::char_traits,std::allocator>::operator =(_Elem)'
1> with
1> [
1> _Elem=char
1> ] (compiling source file units\unitmgr.cpp)
1> g:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring(1027): note: or 'std::basic_string<char,std::char_traits,std::allocator> &std::basic_string<char,std::char_traits,std::allocator>::operator =(const _Elem *)'
1> with
1> [
1> _Elem=char
1> ] (compiling source file units\unitmgr.cpp)
1> g:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring(1011): note: or 'std::basic_string<char,std::char_traits,std::allocator> &std::basic_string<char,std::char_traits,std::allocator>::operator =(const std::basic_string<char,std::char_traits,std::allocator> &)' (compiling source file units\unitmgr.cpp)
1> g:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring(972): note: or 'std::basic_string<char,std::char_traits,std::allocator> &std::basic_string<char,std::char_traits,std::allocator>::operator =(std::initializer_list<_Elem>)'
1> with
1> [
1> _Elem=char
1> ] (compiling source file units\unitmgr.cpp)
1> g:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring(914): note: or 'std::basic_string<char,std::char_traits,std::allocator> &std::basic_string<char,std::char_traits,std::allocator>::operator =(std::basic_string<char,std::char_traits,std::allocator> &&) noexcept' (compiling source file units\unitmgr.cpp)
1> g:\files\smoldy_adventure\src\client\units\unitmgr.cpp(53): note: while trying to match the argument list '(std::string, stlx::basic_jsonstd::map,std::vector,std::string,bool,int64_t,double,std::allocator)'
Compiler: Visual Studio 2015
The text was updated successfully, but these errors were encountered: