benchmark icon indicating copy to clipboard operation
benchmark copied to clipboard

[BUG] Aliased benchmark function does not compile with 1.6.1.

Open buster3 opened this issue 2 years ago • 1 comments

Describe the bug Aliased benchmark function does not compile with 1.6.1.

System

  • OS: Linux
  • Compiler and version: clang 13.0.0

To reproduce Creating an alias of a benchmark function and forwarding the alias to the BENCHMARK macro results in a compile error.

static auto templated_test_double = templated_test<std::complex<double>>;
BENCHMARK(templated_test_double);

Error: "no known conversion from 'void (**)(benchmark::State &)' to 'benchmark::internal::Function *'"

Example: https://godbolt.org/z/3aq4T1as9

Expected behavior Should compile like in version 1.5.0

Additional context Seems to be related to #1262. Is the & required in front of __VA_ARGS__?

  BENCHMARK_PRIVATE_DECLARE(_benchmark_) =                           \
      (::benchmark::internal::RegisterBenchmarkInternal(             \
          new ::benchmark::internal::FunctionBenchmark(#__VA_ARGS__, \
                                                       &__VA_ARGS__)))

buster3 avatar Jul 26 '22 13:07 buster3

@oontvoo

with #1262 i think you shouldn't need the alias any more, but i realise that's not entirely helpful. we should probably add some tests for this use-case too.

dmah42 avatar Jul 26 '22 15:07 dmah42