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

Incorrect detection of std::in_place #45

Open
Pesa opened this issue May 5, 2019 · 1 comment
Open

Incorrect detection of std::in_place #45

Pesa opened this issue May 5, 2019 · 1 comment

Comments

@Pesa
Copy link

Pesa commented May 5, 2019

optional.hpp seems to rely only on the C++ standard version in use to choose between the std::in_place facility from the standard library or its own implementation.

#if optional_CPP17_OR_GREATER
#include <utility>
namespace nonstd {
using std::in_place;
using std::in_place_type;
using std::in_place_index;
using std::in_place_t;
using std::in_place_type_t;
using std::in_place_index_t;

However, simply compiling in C++17 mode doesn't guarantee that the standard library contains these facilities. For instance, this detection technique fails on Ubuntu 16.04 when compiling with clang-5.0 (and the default libstdc++):

$ clang++-5.0 -xc++ -std=c++17 -ferror-limit=5 -c -o /dev/null - <<< '#include "optional.hpp"'
In file included from <stdin>:1:
./optional.hpp:94:12: error: no member named 'in_place' in namespace 'std'
using std::in_place;
      ~~~~~^
./optional.hpp:95:12: error: no member named 'in_place_type' in namespace 'std'
using std::in_place_type;
      ~~~~~^
./optional.hpp:96:12: error: no member named 'in_place_index' in namespace 'std'
using std::in_place_index;
      ~~~~~^
./optional.hpp:97:12: error: no member named 'in_place_t' in namespace 'std'
using std::in_place_t;
      ~~~~~^
./optional.hpp:98:12: error: no member named 'in_place_type_t' in namespace 'std'
using std::in_place_type_t;
      ~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
6 errors generated.
@brennanleez-coder
Copy link

elseif (UNIX)

Turn on C++11

add_definitions(-std=c++17)
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
elseif (APPLE)

Turn on C++17

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
endif (WIN32)

in openpose/CmakeLists make these changes then recompile. Allows me to compile but somehow the detections are not working.

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

2 participants