Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/cereal/archives/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ namespace cereal
void saveLong(T lu){ saveValue( static_cast<std::uint64_t>( lu ) ); }

public:
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure you'd want to do this, clang-cl has the same integer sizes as MSVC, so we'd want the unsigned long overload as well here, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to suppress this error

call to member function 'saveValue' is ambiguous

in json.hpp

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok correction: in our org we never came across this even though our json.hpp looks the same. We're using clang-cl version 8.0.0. I wonder if @durswd has a different configuration whereby sizeof(long) is coming out as 8?

//! MSVC only long overload to current node
void saveValue( unsigned long lu ){ saveLong( lu ); };
#else // _MSC_VER
Expand Down
2 changes: 1 addition & 1 deletion include/cereal/details/polymorphic_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ namespace cereal

auto ptr = PolymorphicCasters::template downcast<T>( dptr, baseInfo );

#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
savePolymorphicSharedPtr( ar, ptr, ::cereal::traits::has_shared_from_this<T>::type() ); // MSVC doesn't like typename here
#else // not _MSC_VER
savePolymorphicSharedPtr( ar, ptr, typename ::cereal::traits::has_shared_from_this<T>::type() );
Expand Down
2 changes: 1 addition & 1 deletion include/cereal/details/static_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */

#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-cl supports declspecs, so I'd imagine this is useful as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

declspec causes this error on clang9

cereal::detail::StaticObject<cereal::detail::bind_to_archives<PolyDerivedLA, cereal::detail::(anonymous namespace)::polymorphic_binding_tag> >' must have external linkage when declared 'dllexport'

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this error can be reproduced on test_polymorphic

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We (myself + @fnabulsi + @bmcdb) got the identical error and had to make the same change, although I acknowledge this may warrant more investigation.

We are testing cereal only with static linking so it wouldn't surprise me if there's more work to ensure that clang-cl can properly build Cereal as a DLL.

# define CEREAL_DLL_EXPORT __declspec(dllexport)
# define CEREAL_USED
#else // clang or gcc
Expand Down