[PATCH] D96794: [ADT] Add SFINAE guards to unique_function constructor.
Kadir Cetinkaya via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 16 10:56:15 PST 2021
kadircet added inline comments.
================
Comment at: llvm/include/llvm/ADT/FunctionExtras.h:361
+ detail::EnableUnlessSameType<CallableT, unique_function> * = nullptr,
+ detail::EnableIfCallable<CallableT, R, P...> * = nullptr)
: Base(std::forward<CallableT>(Callable),
----------------
what about doing this in the constructor of the `UniqueFunctionBase` instead?
================
Comment at: llvm/unittests/ADT/FunctionExtrasTest.cpp:267
+std::string returns(StringRef) { return "not a function"; }
+std::string returns(function_ref<double()> F) { return "number"; }
+std::string returns(function_ref<StringRef()> F) { return "string"; }
----------------
s/function_ref/unique_function/
here and below
================
Comment at: llvm/unittests/ADT/FunctionExtrasTest.cpp:270
+
+TEST(FunctionRefTest, SFINAE) {
+ EXPECT_EQ("not a function", returns("boo!"));
----------------
looks like having multiple tests with the same name is a failure on some buildbots :/
s/FunctionRefTest/UniqueFunctionTest/
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96794/new/
https://reviews.llvm.org/D96794
More information about the llvm-commits
mailing list