Skip to content
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 C4575 when compiled as a C++/CLI .Net Core project with Visual Studio 2019 v16.8 #148

Open
mw4853 opened this issue Nov 16, 2020 · 4 comments

Comments

@mw4853
Copy link

mw4853 commented Nov 16, 2020

If you include a boost header (such as boost/algorithm/string.hpp) that ultimately includes is_funcion_cxx_11.hpp in a C++/CLI .NET Core (NOT the normal .NET Framework) project, you will see a series of compiler warnings similar to the following:

boost-1.74\boost\type_traits\detail\is_function_cxx_11.hpp(114,4): warning C4575: '__vectorcall' incompatible with the '/clr' option: converting to '__stdcall'

struct is_function<Ret __vectorcall(Args...)BOOST_TT_NOEXCEPT_DECL> : public true_type {};

There is no warning here if the C++/CLI project is compiled as .NET Framework instead. It looks like __CLR_VER is defined when building as .NET Framework, but not when building as .NET Core?

How to convert your C++/CLI project to build as .NET Core (instead of the normal .NET Framework):
https://docs.microsoft.com/en-us/dotnet/core/porting/cpp-cli

@mw4853
Copy link
Author

mw4853 commented Nov 16, 2020

Maybe __CLR_VER should be replaced with _MANAGED ?
https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-160

mw4853 added a commit to mw4853/type_traits that referenced this issue Nov 24, 2020
Fixed errors and warnings when C++/CLI projects are compiled as .NET
Core (as opposed to .NET Framework). Visual C++ defines __CLR_VER and
_MANAGED when compiled as .NET Framework, but Visual C++ only defines
_MANAGED when compiled as .NET Core.
Issue: boostorg#148
@millerrt3
Copy link

@mw4853 I believe that this is effectively a duplicate of #123 (even though the specific warning is different in your case, the underlying cause is the same). I filed PR #130 to fix #123 a while back, but there doesn't seem to be much movement towards merging it (or any other fix for the issue).

@mw4853
Copy link
Author

mw4853 commented Nov 30, 2020

@bionicOnion - Darn. I was really hoping to avoid modifying my local copy of Boost, but, it looks like that is what I am going to have to do.

@erikeldh
Copy link

boost\type_traits\detail\is_member_function_pointer_cxx_11.hpp(121,4): warning C4561: '__fastcall' incompatible with the '/clr' option: converting to '__stdcall' boost\type_traits\detail\is_member_function_pointer_cxx_11.hpp(121,113): error C2953: 'boost::is_member_function_pointer<Ret(__stdcall C::* )(Args...)>': class template has already been defined

I believe this still to be an issue with boost 1.75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants