forked from OSchip/llvm-project
Workaround a limitation of llvm::Any when used with types that have
a converting constructor from llvm::Any like gmock matchers. This issue has come up elsewhere as well and the workaround here is being considered for use in the standard long-term, but we can pretty cheaply experiment with it to see if anything ends up going wrong. llvm-svn: 342588
This commit is contained in:
parent
6690802263
commit
a4d75ead9e
|
@ -65,6 +65,16 @@ public:
|
|||
typename std::enable_if<
|
||||
llvm::conjunction<
|
||||
llvm::negation<std::is_same<typename std::decay<T>::type, Any>>,
|
||||
// We also disable this overload when an `Any` object can be
|
||||
// converted to the parameter type because in that case, this
|
||||
// constructor may combine with that conversion during overload
|
||||
// resolution for determining copy constructibility, and then
|
||||
// when we try to determine copy constructibility below we may
|
||||
// infinitely recurse. This is being evaluated by the standards
|
||||
// committee as a potential DR in `std::any` as well, but we're
|
||||
// going ahead and adopting it to work-around usage of `Any` with
|
||||
// types that need to be implicitly convertible from an `Any`.
|
||||
llvm::negation<std::is_convertible<Any, typename std::decay<T>::type>>,
|
||||
std::is_copy_constructible<typename std::decay<T>::type>>::value,
|
||||
int>::type = 0>
|
||||
Any(T &&Value) {
|
||||
|
|
Loading…
Reference in New Issue