hanchenye-llvm-project/llvm/unittests/ADT
David Blaikie 45dc480b75 Ensure function_refs are copyable even from non-const references
A subtle bug was found where attempting to copy a non-const function_ref
lvalue would actually invoke the generic forwarding constructor (as it
was a closer match - being T& rather than the const T& of the implicit
copy constructor). In the particular case this lead to a dangling
function_ref member (since it had referenced the function_ref passed by
value to its ctor, rather than the outer function_ref that was still
alive)

SFINAE the converting constructor to not be considered if the copy
constructor is available and demonstrate that this causes the copy to
refer to the original functor, not to the function_ref it was copied
from. (without the code change, the test would fail as Y would be
referencing X and Y() would see the result of the mutation to X, ie: 2)

llvm-svn: 221753
2014-11-12 02:06:08 +00:00
..
APFloatTest.cpp [ADT] Add an (ADL-friendly) abs free function for APFloat that returns 2014-10-10 08:27:22 +00:00
APIntTest.cpp Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created. 2014-08-27 05:25:25 +00:00
APSIntTest.cpp
ArrayRefTest.cpp Add some negative (and positive) static_assert checks for ArrayRef-of-pointer conversions introduced in r216709 2014-08-31 01:33:41 +00:00
BitVectorTest.cpp
CMakeLists.txt Ensure function_refs are copyable even from non-const references 2014-11-12 02:06:08 +00:00
DAGDeltaAlgorithmTest.cpp
DeltaAlgorithmTest.cpp
DenseMapTest.cpp Fix SmallDenseMap assignment operator. 2014-08-04 22:18:25 +00:00
DenseSetTest.cpp [ADT] Add a 'find_as' operation to DenseSet. 2014-10-19 19:36:33 +00:00
FoldingSet.cpp
FunctionRefTest.cpp Ensure function_refs are copyable even from non-const references 2014-11-12 02:06:08 +00:00
HashingTest.cpp [C++11] Use 'nullptr'. 2014-06-08 22:29:17 +00:00
ImmutableMapTest.cpp [C++11] Use 'nullptr'. 2014-06-08 22:29:17 +00:00
ImmutableSetTest.cpp
IntEqClassesTest.cpp
IntervalMapTest.cpp
IntrusiveRefCntPtrTest.cpp
MakeUniqueTest.cpp [C++11] Add llvm::make_unique, according to N3656. 2014-03-09 11:20:17 +00:00
Makefile
MapVectorTest.cpp Add MapVector::rbegin(), MapVector::rend() to completment MapVector::begin(), MapVector::end(). 2014-10-27 17:20:53 +00:00
OptionalTest.cpp Update test name to match changes made in r218783 2014-10-01 21:19:39 +00:00
PackedVectorTest.cpp
PointerIntPairTest.cpp ADT/PointerIntPairTest.cpp: Appease msc17. 2014-03-10 02:33:17 +00:00
PointerUnionTest.cpp [C++11] Use 'nullptr'. 2014-06-08 22:29:17 +00:00
SCCIteratorTest.cpp [C++11] Use 'nullptr'. 2014-06-08 22:29:17 +00:00
SmallPtrSetTest.cpp
SmallStringTest.cpp Revert "Clean up SmallString a bit" 2014-03-09 06:22:58 +00:00
SmallVectorTest.cpp SmallVectorTest: Make the deleted member functions private to help MSVC users. 2014-06-11 17:50:14 +00:00
SparseBitVectorTest.cpp
SparseMultiSetTest.cpp
SparseSetTest.cpp
StringMapTest.cpp Recommit 211309 (StringMap::insert), reverted in 211328 due to issues with private, but non-deleted, move members. 2014-06-23 18:28:53 +00:00
StringRefTest.cpp Retire llvm::array_endof in favor of non-member std::end. 2014-04-12 16:15:53 +00:00
TinyPtrVectorTest.cpp [C++11] Replace LLVM-style type traits with C++11 standard ones. 2014-03-07 14:42:25 +00:00
TripleTest.cpp Add hsail and amdil64 to Triple 2014-09-19 19:52:11 +00:00
TwineTest.cpp
VariadicFunctionTest.cpp
ilistTest.cpp [C++11] Use 'nullptr'. 2014-06-08 22:29:17 +00:00