-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix pass rvalue to DoNotOptimize #1608
Conversation
include/benchmark/benchmark.h
Outdated
@@ -465,7 +465,7 @@ inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) { | |||
} | |||
|
|||
template <class Tp> | |||
inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp& value) { | |||
inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp&& value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i believe this should be inside the defined(BENCHMARK_HAS_CXX11) section below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
windows build failed with error
seems like it does not related to current PR |
that looks suspiciously like github changed something in the windows image. |
actions/runner-images#7662 may be related |
@dmah42 How to restart checks (seems like issue for windows has been resolved) ? |
i've restarted them. |
still failing, but i'm comfortable that a) it's an issue we can't do much about and b) unlikely to be an issue based on your PR. |
@@ -465,7 +465,13 @@ inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) { | |||
} | |||
|
|||
template <class Tp> | |||
inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp& value) { | |||
inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize( | |||
#ifdef BENCHMARK_HAS_CXX11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have a BENCHMARK_HAS_CXX11 block below. can we not simplify this somehow so this is folded into the version at line 510?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think about this, but in case of reordering blocks, the behaviour will be changed.
on other hand, if the BENCHMARK_HAS_CXX11 related code is moved to separate block - it causes code duplication (
@bgaifullin thank you! |
The windows build still failing with error about missing compiler binary. (( |
@dmah42 can the failing CI runs be un-required? |
thank you! |
Fixes #1584