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

MSVC 1916 does not have a good constexpr 14 support #256

Open
apolukhin opened this issue Dec 16, 2018 · 1 comment
Open

MSVC 1916 does not have a good constexpr 14 support #256

apolukhin opened this issue Dec 16, 2018 · 1 comment

Comments

@apolukhin
Copy link
Member

Looks like BOOST_CXX14_CONSTEXPR should not expand into constexpr for _MSC_VER == 1916, because the support does not seem complete. Here are some errors from the Boost.TypeIndex tests:

[00:03:17] compile-c-c++ ..\..\..\bin.v2\libs\type_index\test\type_index_constexpr_test.test\msvc-14.1\debug\cxxstd-14-iso\threading-multi\type_index_constexpr_test.obj
[00:03:17] type_index_constexpr_test.cpp
[00:03:17] type_index_constexpr_test.cpp(97): error C2131: expression did not evaluate to a constant
[00:03:17] C:\boost-local\boost/type_index/ctti_type_index.hpp(185): note: failure was caused by attempting to access a member on an object of dynamic type 'boost::typeindex::type_index_facade<boost::typeindex::ctti_type_index,boost::typeindex::detail::ctti_data>' in which the member is not defined
[00:03:17] C:\boost-local\boost/type_index/ctti_type_index.hpp(185): note: see usage of 'boost::typeindex::ctti_type_index::data_'
[00:03:17] type_index_constexpr_test.cpp(100): error C2131: expression did not evaluate to a constant

Full log is available at https://ci.appveyor.com/project/apolukhin/type-index/builds/21035855/job/9hcff3l2j4r9o70v

Misc: TypeIndex workaround that helped to fix the test boostorg/type_index@c585d74 .

@jzmaddock
Copy link
Collaborator

Sorry for the delay in getting around to this!

This is a weird one, and I'm not completely convinced msvc is at fault yet. If I change the == operator to:

template <class Derived, class TypeInfo>
BOOST_CXX14_CONSTEXPR inline bool operator == (const type_index_facade<Derived, TypeInfo>& lhs, const type_index_facade<Derived, TypeInfo>& rhs) BOOST_NOEXCEPT {
   constexpr Derived const& d1 = static_cast<Derived const&>(lhs);
   constexpr Derived const& d2 = static_cast<Derived const&>(rhs);
   return d1.equal(d2);
}

Then obviously it can only be used in a constexpr context, but even then both gcc and clang issue (completely inscrutable) errors. But work just fine if I remove the constexpr from d1 and d2.

Confused yours...

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