Commit 65f490e7 authored by Andrew Gallagher's avatar Andrew Gallagher Committed by Facebook Github Bot

folly: workaround modules bug in StaticSingletonManager.h

Summary:
Passing a lambda to `create` causes "definition with same mangled name as
another definition" errors (similar to https://bugs.llvm.org/show_bug.cgi?id=33924).

Reviewed By: pixelb

Differential Revision: D13056795

fbshipit-source-id: ef87ecc79a6a3caef73ea4d366dc3c93773ac9ab
parent 8d60409d
......@@ -71,9 +71,18 @@ FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN T* createGlobal(F&& creator) {
return StaticSingletonManager::create<T, Tag>(static_cast<F&&>(creator));
}
// TODO(T36779215): A bug in the gcc-5-glibc-2.23 llvm-fb/clang doesn't like
// passing this as a lambda (e.g. P60328775).
namespace {
template <typename T>
T* singleton_global_cons() {
return new T();
}
} // namespace
template <typename T, typename Tag>
FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN T* createGlobal() {
return StaticSingletonManager::create<T, Tag>([]() { return new T(); });
return createGlobal<T, Tag>(&singleton_global_cons<T>);
}
} // namespace detail
......
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