mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-23 01:18:52 +08:00
Fix up the final bits of breakage due to clang v5 generating bad implicit template deduction guides - specifically for copy-ctors
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333381 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -9,7 +9,10 @@
|
||||
|
||||
// <array>
|
||||
// UNSUPPORTED: c++98, c++03, c++11, c++14
|
||||
// UNSUPPORTED: clang-5
|
||||
// UNSUPPORTED: libcpp-no-deduction-guides
|
||||
// Clang 5 will generate bad implicit deduction guides
|
||||
// Specifically, for the copy constructor.
|
||||
|
||||
|
||||
// template <class T, class... U>
|
||||
@@ -51,8 +54,6 @@ int main()
|
||||
}
|
||||
|
||||
// Test the implicit deduction guides
|
||||
// FIXME broken: no matching constructor
|
||||
#if 0
|
||||
{
|
||||
std::array<double, 2> source = {4.0, 5.0};
|
||||
std::array arr(source); // array(array)
|
||||
@@ -61,5 +62,4 @@ int main()
|
||||
assert(arr[0] == 4.0);
|
||||
assert(arr[1] == 5.0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@@ -9,7 +9,10 @@
|
||||
|
||||
// <optional>
|
||||
// UNSUPPORTED: c++98, c++03, c++11, c++14
|
||||
// UNSUPPORTED: clang-5
|
||||
// UNSUPPORTED: libcpp-no-deduction-guides
|
||||
// Clang 5 will generate bad implicit deduction guides
|
||||
// Specifically, for the copy constructor.
|
||||
|
||||
|
||||
// template<class T>
|
||||
@@ -28,7 +31,12 @@ int main()
|
||||
// Test the implicit deduction guides
|
||||
{
|
||||
// optional()
|
||||
std::optional opt; // expected-error {{declaration of variable 'opt' with deduced type 'std::optional' requires an initializer}}
|
||||
std::optional opt; // expected-error-re {{{{declaration of variable 'opt' with deduced type 'std::optional' requires an initializer|no viable constructor or deduction guide for deduction of template arguments of 'optional'}}}}
|
||||
// clang-6 gives a bogus error here:
|
||||
// declaration of variable 'opt' with deduced type 'std::optional' requires an initializer
|
||||
// clang-7 (and later) give a better message:
|
||||
// no viable constructor or deduction guide for deduction of template arguments of 'optional'
|
||||
// So we check for one or the other.
|
||||
}
|
||||
|
||||
{
|
||||
|
@@ -9,7 +9,10 @@
|
||||
|
||||
// <optional>
|
||||
// UNSUPPORTED: c++98, c++03, c++11, c++14
|
||||
// UNSUPPORTED: clang-5
|
||||
// UNSUPPORTED: libcpp-no-deduction-guides
|
||||
// Clang 5 will generate bad implicit deduction guides
|
||||
// Specifically, for the copy constructor.
|
||||
|
||||
|
||||
// template<class T>
|
||||
@@ -40,18 +43,12 @@ int main()
|
||||
}
|
||||
|
||||
// Test the implicit deduction guides
|
||||
|
||||
{
|
||||
// optional(const optional &);
|
||||
// FIXME clang and GCC disagree about this!
|
||||
// clang thinks opt is optional<optional<char>>, GCC thinks it's optional<char>.
|
||||
#if 0
|
||||
// optional(optional);
|
||||
std::optional<char> source('A');
|
||||
std::optional opt(source);
|
||||
static_assert(std::is_same_v<decltype(opt), std::optional<std::optional<char>>>, "");
|
||||
static_assert(std::is_same_v<decltype(opt), std::optional<char>>, "");
|
||||
assert(static_cast<bool>(opt) == static_cast<bool>(source));
|
||||
assert(*opt == *source);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user