Commit f169a842 authored by Amol Bhave's avatar Amol Bhave Committed by Facebook Github Bot

Fix CoroBenchmarkNRVO for non FOLLY_HAS_COROUTINE builds

Summary:
This code fails to compile when FOLLY_HAS_COROUTINES is false. This is
because ExpensiveCopy is defined inside the if scope, and if that macro is
false, then ExpensiveCopy never gets defined. Yet it gets used in the nestedCalls function.

This diff fixes build for that case.

Reviewed By: lewissbaker

Differential Revision: D9663539

fbshipit-source-id: 1c3dd70decab7db955c038cd5c476920bfa6ba53
parent e89b8aa9
......@@ -15,6 +15,15 @@
*/
#include <folly/Benchmark.h>
#include <thread>
struct ExpensiveCopy {
ExpensiveCopy() {}
ExpensiveCopy(const ExpensiveCopy&) {
std::this_thread::sleep_for(std::chrono::milliseconds{1});
}
};
#if FOLLY_HAS_COROUTINES
#include <experimental/coroutine>
......@@ -155,14 +164,6 @@ class InlineTask {
promise_type* promise_;
};
struct ExpensiveCopy {
ExpensiveCopy() {}
ExpensiveCopy(const ExpensiveCopy&) {
std::this_thread::sleep_for(std::chrono::milliseconds{1});
}
};
InlineTask<ExpensiveCopy> co_nestedCalls(size_t times) {
ExpensiveCopy ret;
if (times > 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment