llvm.org GIT mirror llvm / 11f7e93
[ADT] Use explicit constructors for DenseMapPair to work around compiler issues. Inheriting constructors from std::pair caused clang-3.8 to treat some DenseMap initializer_list constructor calls as ambiguous, which broke several bots. This commit explicitly defines DenseMapPair's constructos to work around the issue. https://reviews.llvm.org/D53726 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345411 91177308-0d34-0410-b5e6-96231b3b80d8 Lang Hames 1 year, 8 months ago
1 changed file(s) with 26 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
3939 template
4040 struct DenseMapPair : public std::pair {
4141
42 using std::pair::pair;
42 // FIXME: Switch to inheriting constructors when we drop support for older
43 // clang versions.
44 // NOTE: This default constructor is declared with '{}' rather than
45 // '= default' to work around a separate bug in clang-3.8. This can
46 // also go when we switch to inheriting constructors.
47 DenseMapPair() {}
48
49 DenseMapPair(const KeyT &Key, const ValueT &Value)
50 : std::pair(Key, Value) {}
51
52 DenseMapPair(KeyT &&Key, ValueT &&Value)
53 : std::pair(std::move(Key), std::move(Value)) {}
54
55 template
56 DenseMapPair(AltKeyT &&AltKey, AltValueT &&AltValue,
57 typename std::enable_if<
58 std::is_convertible::value &&
59 std::is_convertible::value>::type * = 0)
60 : std::pair(std::forward(AltKey),
61 std::forward(AltValue)) {}
62
63 template
64 DenseMapPair(AltPairT &&AltPair,
65 typename std::enable_if
66 AltPairT, std::pair>::value>::type * = 0)
67 : std::pair(std::forward(AltPair)) {}
4368
4469 KeyT &getFirst() { return std::pair::first; }
4570 const KeyT &getFirst() const { return std::pair::first; }