-
-
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
Warning on Intel compiler (icc 17) #550
Comments
Thanks for the report! We never got feedback on using ICC so far. May I ask which version of the library you are using? |
2.1.1 (latest I think?). |
Just to better understand: is it a warning or an error? |
A warning.
… On Apr 8, 2017, at 15:48, Niels Lohmann ***@***.***> wrote:
Just to better understand: is it a warning or an error?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Ok. I applied for a free version of ICC to check this myself. |
I can confirm the error. cmake output
|
But this error looks weird:
This is the code: iter_impl& operator=(iter_impl other) noexcept(
std::is_nothrow_move_constructible<pointer>::value and
std::is_nothrow_move_assignable<pointer>::value and
std::is_nothrow_move_constructible<internal_iterator>::value and
std::is_nothrow_move_assignable<internal_iterator>::value
)
{
std::swap(m_object, other.m_object);
std::swap(m_it, other.m_it);
return *this;
} |
Yeah that looks like it. I didn't see the second one, but our build system was warnings-as-errors enabled by default so I think it just bailed at the first one. |
I haven't fully understood the warning in the first place... |
There's some info on that Intel forum post in the OP. The example they give is: template <class T>
class B
{
operator B() const { };
}; So this says "convert to a B", but there is no such thing as type B, only type Or something like that :) |
To use your example: using const_iterator = iter_impl<const basic_json>;
template<typename U>
class iter_impl
{
operator const_iterator() const { };
}; I tried to change the operator to use
|
Maybe @Bosswestfalen has an idea - he wrote that code in the first place ;-) |
The I think we can just define a constructor and assignment from iterator type to the general iterator type (both const and non const), instead of So the signature of the constructor may look like this: iter_impl(const iter_impl<basic_json> &); |
I set up the Intel studio environment and tested. Using a converting constructor from As for the second error, it's due to the Fixing these two allows my compiling went through 31%, but then it stopped because my virtual machine ran out of memory. I couldn't test further. Hopefully there wouldn't be any more errors. |
#550 Fix iterator related compiling issues for Intel icc
Fixed with #598. |
The warning below is generated when compiling with icc. I realise this is likely the compiler's fault, but perhaps there is a workaround which would make it work.
edit Actually Intel seem to think it's a valid warning: https://software.intel.com/en-us/forums/intel-c-compiler/topic/596393
nlohmann-json/json/json.hpp(9024): error #597: "nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::iter_impl::operator nlohmann::basic_json<std::map, std::vector, std::string, bool, int64_t={long}, uint64_t={unsigned long}, double, std::allocator, nlohmann::adl_serializer>::iter_impl<const nlohmann::basic_json<std::map, std::vector, std::string, bool,
int64_t={long}, uint64_t={unsigned long}, double, std::allocator, nlohmann::adl_serializer>>() const [with ObjectType=std::map, ArrayType=std::vector, StringType=std::string, BooleanType=bool, NumberIntegerType=int64_t={long}, NumberUnsignedType=uint64_t={unsigned long}, NumberFloatType=double, AllocatorType=std::allocator, JSONSerializer=nlohmann::adl_serializer, U=const nlohmann::basic_json<std::map, std::vector, std::string, bool, int64_t={long}, uint64_t={unsigned long}, double,
std::allocator, nlohmann::adl_serializer>]" will not be called for implicit or explicit conversions
operator const_iterator() const
^
detected during instantiation of class "nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::iter_impl [with ObjectType=std::map, ArrayType=std::vector, StringType=std::string, BooleanType=bool, NumberIntegerType=int64_t={long}, NumberUnsignedType=uint64_t={unsigned long}, NumberFloatType=double, AllocatorType=std::allocator, JSONSerializer=nlohmann::adl_serializer, U=const
nlohmann::basic_json<std::map, std::vector, std::string, bool, int64_t={long}, uint64_t={unsigned long}, double, std::allocator, nlohmann::adl_serializer>]"
The text was updated successfully, but these errors were encountered: