Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Fix compiling with MSVC 2015 #118

Merged
merged 1 commit into from
Mar 17, 2021

Conversation

jeremyg-lunarg
Copy link
Contributor

The pair(piecewise_construct_t, ...) constructor causes the error
"C2476: ‘constexpr’ constructor does not initialize all members"

The best information about this error is:
https://devblogs.microsoft.com/cppblog/c11-constant-expressions-in-visual-studio-2015-rc/
but the error happens even with 2015 Update 3.

The test cases that use piecewise_construct_t, try_emplace() or compact() cause internal
compiler errors.

Copy link
Owner

@martinus martinus left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! Some minor suggestions from me

@@ -188,6 +188,11 @@ static Counts& counts() {
# else
# define ROBIN_HOOD_PRIVATE_DEFINITION_HAS_NATIVE_WCHART() 0
# endif
# if _MSC_VER <= 1900
# define ROBIN_HOOD_BROKEN_CONSTEXPR 1
Copy link
Owner

Choose a reason for hiding this comment

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

I'd prefer a separate section for this, and to use the PRIVATE_DEFINITION thingy, something like this:

#if defined(_MSC_VER) && (_MSC_VER <= 1900)
#        define ROBIN_HOOD_PRIVATE_DEFINITION_BROKEN_CONSTEXPR() 1
#else
#        define ROBIN_HOOD_PRIVATE_DEFINITION_BROKEN_CONSTEXPR() 0
#endif

Then the define is always available and can be used like this:

#if !ROBIN_HOOD(BROKEN_CONSTEXPR)
    constexpr
#endif

@@ -2233,8 +2233,8 @@ struct IterationLogic::Impl {
hash = hash_combine(std::hash<std::string>{}(mBench.title()), hash);
hash = hash_combine(std::hash<std::string>{}(mBench.timeUnitName()), hash);
hash = hash_combine(std::hash<double>{}(mBench.timeUnit().count()), hash);
hash = hash_combine(mBench.relative(), hash);
hash = hash_combine(mBench.performanceCounters(), hash);
hash = hash_combine(std::hash<bool>{}(mBench.relative()), hash);
Copy link
Owner

Choose a reason for hiding this comment

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

Note to self: this will have to be fixed in upstream nanobench at https://github.com/martinus/nanobench

The pair(piecewise_construct_t, ...) constructor causes the error
"C2476: ‘constexpr’ constructor does not initialize all members"

The best information about this error is:
https://devblogs.microsoft.com/cppblog/c11-constant-expressions-in-visual-studio-2015-rc/
but the error happens even with 2015 Update 3.

The test cases that use piecewise_construct_t, try_emplace() or compact() cause internal
compiler errors.
@martinus martinus merged commit eee46f9 into martinus:master Mar 17, 2021
sthagen added a commit to sthagen/martinus-robin-hood-hashing that referenced this pull request Mar 17, 2021
Fix compiling with MSVC 2015 (martinus#118)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants