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

Feature vs2015 support #339

Merged
merged 9 commits into from Aug 15, 2015
Merged

Conversation

jonitis
Copy link
Contributor

@jonitis jonitis commented Aug 11, 2015

Visual Studio 2015 is c++11 compliant.
Just had to fix one error about member ref-specifiers.

@redboltz
Copy link
Contributor

It seems that your PR got compile errors on MSVC. https://ci.appveyor.com/project/redboltz/msgpack-c/build/1.1.0.82

Recently, I merged many PRs. Some of problems that your PR solves have already solved. Could you review your PR?

I recommend that close this PR once and create another one that is focused on the rest issues.

@redboltz
Copy link
Contributor

I misunderstood about your PR. Please ignore above comment. I checked https://github.com/msgpack/msgpack-c/pull/339/files again. I understand that you are trying to support C++11 on MSVC2015. msgpack-c requires many C++11 features on C++11 mode. I'm not sure MSVC2015 supports them. If MSVC2015 support them, it's time to use msgpack-c C++11 mode on MSVC2015.

It seems that the Appveyor uses MSVC 2015. The log message said "Visual Studio 14 2015". So, could you check https://ci.appveyor.com/project/redboltz/msgpack-c/build/1.1.0.82 ?

@jonitis
Copy link
Contributor Author

jonitis commented Aug 14, 2015

Hello,
To be frank I had no time to investigate AppVeyor, because I do not understand how it did not fail without may changes. 2 months ago I needed msgpack c++11 headers-only mode. It was broken with Visual Studio 2013 SP5 (probably worked with older SP). But I was able to get it working with then available VS2015 RC (with some tweaks). Now when VS2015 is officially released I can compile my code (no Boost, no exotic containers except std::vector) without problems. The only change was related to tuples and ref qualifiers. At least it did not broke gcc and clang.

@redboltz
Copy link
Contributor

Hi @jonitis, thank you for the reply. I understand your situation. Now, I started developing msgpack-c C++11 mode on MSVC2015. However, I got some errors. I suspect that MSVC's bug but I need to write a minimal code to reproduce the bug. Anyway, I will inform you when C++11 mode of the msgpack-c would support MSVC2015.

@jonitis
Copy link
Contributor Author

jonitis commented Aug 14, 2015

Takatoshi san, thank you very much for your promptly replies. I appreciate very much how fast you integrated my pull requests etc. Now msgpack fullfills my needs, but if something annoying will show up with VS2015 I will propose at least initial patch. Unfortunately I can't spend too much time on VS, since our main platform is Linux on OpenWrt.

@redboltz redboltz merged commit 8f8d180 into msgpack:master Aug 15, 2015
@redboltz
Copy link
Contributor

Merged.
All other tests have been passed except the following two tests on MSVC2015. So I removed them from MSVC2015 C++11 build.
See:
1c810bc

In the case that std::tuple contains non default constructible classes, when calling 'as' operation, compiler error is occurred. The error said that default constructor is called from std::tuple. I'm not sure why it happens. That is only one problem that I recognized, so far. I decided to merge the PR with some modification.

If someone remove #if !defined(_MSC_VER) from the code I mentioned above, and would fix the compile error, msgpack-c C++11 support for MSVC2015 would complete.

@reza-ebrahimi
Copy link

@redboltz Currently still can't use msgpack static library with MSVC 2015 Compiler, it gives me following compiler time errors:

Error   C2955   'msgpack::v1::packer': use of class template requires template argument list 

Error   C2440   'static_cast': cannot convert from 'msgpack::v1::object::with_zone' to 'msgpack::v2::object &' 

@redboltz
Copy link
Contributor

@reza-ebrahimi msgpack-c passes all tests on MSVC2015. See appveyor result:
https://ci.appveyor.com/project/redboltz/msgpack-c/branch/master/job/fsgdg7jdj4k6bgra

Which code did you get the error?

@reza-ebrahimi
Copy link

reza-ebrahimi commented May 13, 2016

@redboltz Assume that I have a simple class named A:

#include <msgpack/adaptor/define.hpp>
class A {
    A() {}
    ~A() {}
}

When try to build above class with VS2015, compile error happens in msgpack API headers (note that MSGPACK_USE_CPP03 is not defined):

adaptor_base_decl.hpp(49): error C2955: 'msgpack::v1::packer': use of class template requires template argument list
adaptor_base_decl.hpp(23): note: see declaration of 'msgpack::v1::packer'
adaptor_base_decl.hpp(49): error C2988: unrecognizable template declaration/definition
adaptor_base_decl.hpp(49): error C2059: syntax error: '<'

and:

int.hpp(353): error C2440: 'static_cast': cannot convert from 'msgpack::v1::object::with_zone' to 'msgpack::v2::object &'
int.hpp(353): note: static_cast and safe_cast to reference can only be used for valid initializations or for lvalue casts between related classes
int.hpp(359): error C2440: 'static_cast': cannot convert from 'msgpack::v1::object::with_zone' to 'msgpack::v2::object &'
int.hpp(359): note: static_cast and safe_cast to reference can only be used for valid initializations or for lvalue casts between related classes
int.hpp(365): error C2440: 'static_cast': cannot convert from 'msgpack::v1::object::with_zone' to 'msgpack::v2::object &'
int.hpp(365): note: static_cast and safe_cast to reference can only be used for valid initializations or for lvalue casts between related classes
int.hpp(371): error C2440: 'static_cast': cannot convert from 'msgpack::v1::object::with_zone' to 'msgpack::v2::object &'
int.hpp(371): note: static_cast and safe_cast to reference can only be used for valid initializations or for lvalue casts between related classes
int.hpp(377): error C2440: 'static_cast': cannot convert from 'msgpack::v1::object::with_zone' to 'msgpack::v2::object &'
int.hpp(377): note: static_cast and safe_cast to reference can only be used for valid initializations or for lvalue casts between related classes
int.hpp(383): error C2440: 'static_cast': cannot convert from 'msgpack::v1::object::with_zone' to 'msgpack::v2::object &'
int.hpp(383): note: static_cast and safe_cast to reference can only be used for valid initializations or for lvalue casts between related classes
int.hpp(389): error C2440: 'static_cast': cannot convert from 'msgpack::v1::object::with_zone' to 'msgpack::v2::object &'
int.hpp(389): note: static_cast and safe_cast to reference can only be used for valid initializations or for lvalue casts between related classes
int.hpp(395): error C2440: 'static_cast': cannot convert from 'msgpack::v1::object::with_zone' to 'msgpack::v2::object &'
int.hpp(395): note: static_cast and safe_cast to reference can only be used for valid initializations or for lvalue casts between related classes
int.hpp(401): error C2440: 'static_cast': cannot convert from 'msgpack::v1::object::with_zone' to 'msgpack::v2::object &'
int.hpp(401): note: static_cast and safe_cast to reference can only be used for valid initializations or for lvalue casts between related classes
int.hpp(407): error C2440: 'static_cast': cannot convert from 'msgpack::v1::object::with_zone' to 'msgpack::v2::object &'
int.hpp(407): note: static_cast and safe_cast to reference can only be used for valid initializations or for lvalue casts between related classes
int.hpp(413): error C2440: 'static_cast': cannot convert from 'msgpack::v1::object::with_zone' to 'msgpack::v2::object &'
int.hpp(413): note: static_cast and safe_cast to reference can only be used for valid initializations or for lvalue casts between related classes

for more information, when configure and generate project file using cmake, it generate some warnings:
CMake version: 3.5.2

The C compiler identification is MSVC 19.0.23026.0
The CXX compiler identification is MSVC 19.0.23026.0
Check for working C compiler using: Visual Studio 14 2015
Check for working C compiler using: Visual Studio 14 2015 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 14 2015
Check for working CXX compiler using: Visual Studio 14 2015 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
CMake Warning (dev) at CMakeLists.txt:47 (IF):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:52 (ELSEIF):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:54 (ELSEIF):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

Could NOT find GTest (missing:  GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) 
Could NOT find ZLIB (missing:  ZLIB_LIBRARY ZLIB_INCLUDE_DIR) 
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE  
Performing Test MSGPACK_ENABLE_GCC_CXX_ATOMIC
Performing Test MSGPACK_ENABLE_GCC_CXX_ATOMIC - Failed
CMake Warning (dev) at CMakeLists.txt:440 (IF):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:447 (IF):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:454 (IF):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:464 (IF):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:472 (IF):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at example/c/CMakeLists.txt:22 (IF):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at example/c/CMakeLists.txt:26 (IF):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at example/c/CMakeLists.txt:30 (IF):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at example/c/CMakeLists.txt:37 (IF):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at example/cpp03/CMakeLists.txt:40 (IF):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at example/cpp03/CMakeLists.txt:43 (IF):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
Configuring done
Generating done

@redboltz
Copy link
Contributor

redboltz commented May 13, 2016

@reza-ebrahimi, could you post a minimal and complete source code that reproduces the error? Even if the error happens in the msgpack-c header, I can't find the reason without the source code.

@redboltz
Copy link
Contributor

@reza-ebrahimi, what does the project pictures mean? I need a minimal and complete program.
Could you create it? An instruction to create such code is here:
https://gcc.gnu.org/bugs/minimize.html

@reza-ebrahimi
Copy link

reza-ebrahimi commented May 13, 2016

@redboltz I send to you my test project, please download and compile it, is it ok?

https://www.dropbox.com/s/kuqyk6i2ksy02da/msgpackCompileError.rar?dl=0

Test project compile error snapshot:

untitled

@redboltz
Copy link
Contributor

@reza-ebrahimi, thank you! I will check it.

@redboltz
Copy link
Contributor

I reproduced the problem. I will fix it soon.

By the way, msgpack-c provides msgpack.hpp for convenience. If you include msgpack.hpp instead of msgpack/adaptor/define.hpp, no errors are detected. It might be a workaround.

Of course, if you include msgpack/adaptor/define.hpp directly, compile errors shouldn't occur. So I will fix it.

@redboltz
Copy link
Contributor

I create the issue for the problem. See #463.

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

Successfully merging this pull request may close these issues.

None yet

3 participants