google / benchmark

A microbenchmark support library
Apache License 2.0
8.69k stars 1.59k forks source link

[BUG] Examples from User Guide trigger deprecation warning for const-reference `DoNotOptimize` #1566

Closed mjacobse closed 1 year ago

mjacobse commented 1 year ago

A few examples from the User Guide trigger the warning introduced with https://github.com/google/benchmark/pull/1493 for the const-reference version of DoNotOptimize:

As far as I understand, the intended solution is to introduce temporaries and pass those to DoNotOptimize like in https://github.com/google/benchmark/pull/1562? If so, I propose to change the examples accordingly to show users how to use DoNotOptimize properly without getting the warning.