operator::* needs implicit
authorNicholas Ormrod <njormrod@fb.com>
Thu, 30 Oct 2014 21:15:02 +0000 (14:15 -0700)
committerPavlo Kushnir <pavlo@fb.com>
Sat, 8 Nov 2014 02:12:13 +0000 (18:12 -0800)
Summary:
operator::* needs to be explicit, or explicitly labeled
implicit. The build breaks with explicit, so label.

Test Plan: run unit tests

Reviewed By: andrei.alexandrescu@fb.com

Subscribers: sdwilsh, njormrod, folly-diffs@

FB internal diff: D1644176

Tasks: 5486739

Signature: t1:1644176:1414693471:e3a08e27ba27a5ae0e4b9a5e009acf0a16728c45

folly/Benchmark.h

index 41d133849297bff5f55d03ead610ca1dfd489e5c..04411f633707ac9906f980c3d92b179a57dce800 100644 (file)
@@ -149,12 +149,11 @@ struct BenchmarkSuspender {
   }
 
   /**
-   * This helps the macro definition. To get around the dangers of
-   * operator bool, returns a pointer to member (which allows no
-   * arithmetic).
+   * This is for use inside of if-conditions, used in BENCHMARK macros.
+   * If-conditions bypass the explicit on operator bool.
    */
-  operator int BenchmarkSuspender::*() const {
-    return nullptr;
+  explicit operator bool() const {
+    return false;
   }
 
   /**