[all-commits] [llvm/llvm-project] 17c584: ADT: Add SFINAE to the generic IntrusiveRefCntPtr ...
Duncan P. N. Exon Smith via All-commits
all-commits at lists.llvm.org
Thu Jan 28 15:09:44 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 17c584551d573f1693990773e29fbe6b4b6fa4f4
https://github.com/llvm/llvm-project/commit/17c584551d573f1693990773e29fbe6b4b6fa4f4
Author: Duncan P. N. Exon Smith <dexonsmith at apple.com>
Date: 2021-01-28 (Thu, 28 Jan 2021)
Changed paths:
M llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
M llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp
Log Message:
-----------
ADT: Add SFINAE to the generic IntrusiveRefCntPtr constructors
Add an `enable_if` to the generic `IntrusiveRefCntPtr` constructors so
that std::is_convertible gives an honest answer when the underlying
pointers cannot be converted. Added `static_assert`s to the test suite
to verify.
Also combine generic constructors from `IntrusiveRefCntPtr<X>&&` and
`const IntrusiveRefCntPtr<X>&`. At first glance this appears to be an
infinite loop, but the real copy/move constructors are spelled out
separately above. Added a unit test to verify.
Differential Revision: https://reviews.llvm.org/D95498
More information about the All-commits
mailing list