From d1e11a1a6ffb00b56238d2176f5d0722fe97a6e4 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 28 May 2018 19:20:21 +0000 Subject: [PATCH] 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 --- .../sequences/array/array.cons/deduct.pass.cpp | 6 +++--- .../optional.object.ctor/deduct.fail.cpp | 10 +++++++++- .../optional.object.ctor/deduct.pass.cpp | 13 +++++-------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/test/std/containers/sequences/array/array.cons/deduct.pass.cpp b/test/std/containers/sequences/array/array.cons/deduct.pass.cpp index faa6223bc..0f41c7b81 100644 --- a/test/std/containers/sequences/array/array.cons/deduct.pass.cpp +++ b/test/std/containers/sequences/array/array.cons/deduct.pass.cpp @@ -9,7 +9,10 @@ // // 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 @@ -51,8 +54,6 @@ int main() } // Test the implicit deduction guides -// FIXME broken: no matching constructor -#if 0 { std::array 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 } diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.fail.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.fail.cpp index 5bbb77d46..b76b730d2 100644 --- a/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.fail.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.fail.cpp @@ -9,7 +9,10 @@ // // 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 @@ -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. } { diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp index 807055eed..0a5f45668 100644 --- a/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.pass.cpp @@ -9,7 +9,10 @@ // // 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 @@ -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>, GCC thinks it's optional. -#if 0 +// optional(optional); std::optional source('A'); std::optional opt(source); - static_assert(std::is_same_v>>, ""); + static_assert(std::is_same_v>, ""); assert(static_cast(opt) == static_cast(source)); assert(*opt == *source); -#endif } - }