diff options
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/ADT/Any.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/Any.h b/llvm/include/llvm/ADT/Any.h index c64c3998754..7faa4c963d3 100644 --- a/llvm/include/llvm/ADT/Any.h +++ b/llvm/include/llvm/ADT/Any.h @@ -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) { |