diff --git a/regression-tests/pure2-bugfix-for-deducible-parameters.cpp2 b/regression-tests/pure2-bugfix-for-deducible-parameters.cpp2 index 0a9565f36..cd371175b 100644 --- a/regression-tests/pure2-bugfix-for-deducible-parameters.cpp2 +++ b/regression-tests/pure2-bugfix-for-deducible-parameters.cpp2 @@ -18,8 +18,15 @@ main: () = { _ = : (x: std::vector>) = {}(:std::vector> = ()); // Uncomment once `typename` is supported for template arguments. // _ = : (x: std::pair, y: U) = {}(:std::pair = (0, 0), z); + _ = : (x: std::array, y: U) = {}(:std::array = (), z); init(out z, z); id(z, z); + + // Test that these are emitted unwrapped in case they are deducible. + (copy f := : (x: std::vector>) = {}) + static_assert(!std::is_invocable_v>); + (copy f := : (x: std::vector>) = {}) + static_assert(std::is_invocable_v>>); } v: type = { diff --git a/regression-tests/test-results/pure2-bugfix-for-deducible-parameters.cpp b/regression-tests/test-results/pure2-bugfix-for-deducible-parameters.cpp index d4d843bd7..5a8530703 100644 --- a/regression-tests/test-results/pure2-bugfix-for-deducible-parameters.cpp +++ b/regression-tests/test-results/pure2-bugfix-for-deducible-parameters.cpp @@ -7,7 +7,7 @@ #include "cpp2util.h" -#line 25 "pure2-bugfix-for-deducible-parameters.cpp2" +#line 32 "pure2-bugfix-for-deducible-parameters.cpp2" template class v; @@ -24,15 +24,15 @@ template auto id(cpp2::in auto main() -> int; -#line 25 "pure2-bugfix-for-deducible-parameters.cpp2" +#line 32 "pure2-bugfix-for-deducible-parameters.cpp2" template class v { public: explicit v(T const& x); -#line 26 "pure2-bugfix-for-deducible-parameters.cpp2" +#line 33 "pure2-bugfix-for-deducible-parameters.cpp2" public: auto operator=(T const& x) -> v& ; public: v(v const&) = delete; /* No 'that' constructor, suppress copy */ public: auto operator=(v const&) -> void = delete; -#line 27 "pure2-bugfix-for-deducible-parameters.cpp2" +#line 34 "pure2-bugfix-for-deducible-parameters.cpp2" }; @@ -58,15 +58,31 @@ auto main() -> int{ (void) [](std::vector> const& x) -> void{}(std::vector>{}); // Uncomment once `typename` is supported for template arguments. // _ = : (x: std::pair, y: U) = {}(:std::pair = (0, 0), z); + (void) [](std::array const& x, U const& y) -> void{}(std::array{}, z.value()); init(cpp2::out(&z.value()), z.value()); id(z.value(), std::move(z.value())); +{ +auto f = [](std::vector> const& x) -> void{}; + + // Test that these are emitted unwrapped in case they are deducible. + +#line 27 "pure2-bugfix-for-deducible-parameters.cpp2" + static_assert(!(std::is_invocable_v>)); +} +{ +auto f = [](std::vector> const& x) -> void{}; + +#line 29 "pure2-bugfix-for-deducible-parameters.cpp2" + static_assert(std::is_invocable_v>>); +} +#line 30 "pure2-bugfix-for-deducible-parameters.cpp2" } -#line 26 "pure2-bugfix-for-deducible-parameters.cpp2" +#line 33 "pure2-bugfix-for-deducible-parameters.cpp2" template v::v(T const& x){} -#line 26 "pure2-bugfix-for-deducible-parameters.cpp2" +#line 33 "pure2-bugfix-for-deducible-parameters.cpp2" template auto v::operator=(T const& x) -> v& { return *this; -#line 26 "pure2-bugfix-for-deducible-parameters.cpp2" +#line 33 "pure2-bugfix-for-deducible-parameters.cpp2" }