Skip to content

Commit

Permalink
test: update results after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
JohelEGP committed Aug 14, 2023
1 parent 83881bf commit 58ee983
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ template<typename T> class v;
// are wrapped like non-dependent parameters.
#line 3 "pure2-bugfix-for-deducible-parameters.cpp2"
template<typename T> auto init(cpp2::out<std::integral_constant<cpp2::i32,T::value>> x) -> void;
template<typename T> auto init(cpp2::out<std::integral_constant<cpp2::i32,T::value>> x, T const& _) -> void;
template<typename T> auto init(cpp2::out<std::integral_constant<cpp2::i32,T::value>> x, [[maybe_unused]] T const& param2) -> void;
template<typename T> [[nodiscard]] auto id(cpp2::in<std::integral_constant<cpp2::i32,T::value>> x) -> auto&&;
template<typename T> auto id(cpp2::in<std::integral_constant<cpp2::i32,T::value>> x, T const& y) -> void;

Expand All @@ -41,7 +41,7 @@ template<typename T> class v {

#line 3 "pure2-bugfix-for-deducible-parameters.cpp2"
template<typename T> auto init(cpp2::out<std::integral_constant<cpp2::i32,T::value>> x) -> void{x.construct(); }
template<typename T> auto init(cpp2::out<std::integral_constant<cpp2::i32,T::value>> x, T const& _) -> void{x.construct(); }
template<typename T> auto init(cpp2::out<std::integral_constant<cpp2::i32,T::value>> x, [[maybe_unused]] T const& param2) -> void{x.construct(); }
template<typename T> [[nodiscard]] auto id(cpp2::in<std::integral_constant<cpp2::i32,T::value>> x) -> auto&& { return x; }
template<typename T> auto id(cpp2::in<std::integral_constant<cpp2::i32,T::value>> x, T const& y) -> void{cpp2::Default.expects(&x==&y, ""); }

Expand All @@ -53,12 +53,12 @@ auto main() -> int{
cpp2::Default.expects(&id<zero>(z.value())==&z.value(), "");

// Deducible parameters.
(void) v{0};
(void) []<typename T>(std::vector<T> const& x) -> void{}(std::vector<cpp2::i32>{});
(void) []<typename T>(std::vector<std::vector<T>> const& x) -> void{}(std::vector<std::vector<cpp2::i32>>{});
static_cast<void>(v{0});
static_cast<void>([]<typename T>(std::vector<T> const& x) -> void{}(std::vector<cpp2::i32>{}));
static_cast<void>([]<typename T>(std::vector<std::vector<T>> const& x) -> void{}(std::vector<std::vector<cpp2::i32>>{}));
// Uncomment once `typename` is supported for template arguments.
// _ = :<T, U> (x: std::pair<T, typename U::value_type>, y: U) = {}(:std::pair = (0, 0), z);
(void) []<typename T, typename U>(std::array<T,U::value> const& x, U const& y) -> void{}(std::array<cpp2::i32,0>{}, z.value());
static_cast<void>([]<typename T, typename U>(std::array<T,U::value> const& x, U const& y) -> void{}(std::array<cpp2::i32,0>{}, z.value()));
init(cpp2::out(&z.value()), z.value());
id(z.value(), std::move(z.value()));
{
Expand Down
66 changes: 33 additions & 33 deletions regression-tests/test-results/pure2-bugfix-for-dependent-types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,76 +46,76 @@ template<typename T, T::value_type V> [[nodiscard]] auto f(cpp2::in<typename T::
return { typename T::value_type{x} };

// Dependent *template-id*s.
(void) typename identity<T>::value_type{};// First identifier.
(void) typename std::optional<T>::value_type{};// Non-first identifier.
(void) typename std::array<cpp2::i32,T::value>::value_type{};
(void) typename std::array<cpp2::i32,T::value + T::value>::value_type{};
static_cast<void>(typename identity<T>::value_type{});// First identifier.
static_cast<void>(typename std::optional<T>::value_type{});// Non-first identifier.
static_cast<void>(typename std::array<cpp2::i32,T::value>::value_type{});
static_cast<void>(typename std::array<cpp2::i32,T::value + T::value>::value_type{});

// Emitted `template`.
using ptr = T*; // Needed, pending #502.
using nptr = cpp2::i32*; // Needed, pending #502.
(void) typename std::pointer_traits<ptr>::template rebind<ptr>{};// Type-only context.
(void) std::pointer_traits<nptr>::rebind<nptr>{}; // Non-dependent.
(void) std::pointer_traits<nptr>::rebind<ptr>{}; // Dependent on the nested template.
(void) typename std::pointer_traits<ptr>::template rebind<nptr>{};// Dependent on the outer template.
static_cast<void>(typename std::pointer_traits<ptr>::template rebind<ptr>{});// Type-only context.
static_cast<void>(std::pointer_traits<nptr>::rebind<nptr>{});// Non-dependent.
static_cast<void>(std::pointer_traits<nptr>::rebind<ptr>{});// Dependent on the nested template.
static_cast<void>(typename std::pointer_traits<ptr>::template rebind<nptr>{});// Dependent on the outer template.
// Uncomment once `typename` is supported for template arguments.
// _ = :identity<typename std::pointer_traits<ptr>::rebind<ptr>> = (); // Non type-only context.

// Aliases.
using w = T;
(void) typename w::value_type{x};
static_cast<void>(typename w::value_type{x});
using v = w;
(void) typename v::value_type{x};
static_cast<void>(typename v::value_type{x});
using a = T::type;
(void) typename a::value_type{x};
static_cast<void>(typename a::value_type{x});

{
// Test that there's no prefixed `typename` to....
(void) std::integral_constant<cpp2::i32,T::value>();// `T::value`.
(void) std::type_identity_t<T>{}; // `std::type_identity_t<T>`.
static_cast<void>(std::integral_constant<cpp2::i32,T::value>());// `T::value`.
static_cast<void>(std::type_identity_t<T>{});// `std::type_identity_t<T>`.

// Test that non-dependent names aren't emitted with `typename`.
using a = std::integral_constant<cpp2::i32,0>;
using b = a;
using c = b;
(void) b::value_type{x};
(void) c::value_type{x};
static_cast<void>(b::value_type{x});
static_cast<void>(c::value_type{x});
}
}

#line 56 "pure2-bugfix-for-dependent-types.cpp2"
auto main() -> int{
using zero = std::integral_constant<cpp2::i32,0>;
(void) f<zero,0>(0);
static_cast<void>(f<zero,0>(0));

// Emitted `template` (noop, taken care of by the UFCS macro).
(void) [](auto const& f) -> void{(void) CPP2_UFCS_TEMPLATE_0(operator(), (<cpp2::i32>), f); }([]<typename T>() -> void{});
static_cast<void>([](auto const& f) -> void{static_cast<void>(CPP2_UFCS_TEMPLATE_0(operator(), (<cpp2::i32>), f)); }([]<typename T>() -> void{}));

// Nesting is irrelevant.
(void) []<typename T>() -> void{(void) typename T::value_type{}; };
(void) []() -> void{(void) []<typename T>() -> void{(void) typename T::value_type{}; }; };
(void) []() -> void{(void) []() -> void{(void) []<typename T>() -> void{(void) typename T::value_type{}; }; }; };
(void) []() -> void{(void) []() -> void{(void) []() -> void{(void) []<typename T>() -> void{(void) typename T::value_type{}; }; }; }; };
(void) []() -> void{(void) []() -> void{(void) []<typename T>() -> void{(void) []() -> void{(void) typename T::value_type{}; }; }; }; };
(void) []() -> void{(void) []<typename T>() -> void{(void) []() -> void{(void) []() -> void{(void) typename T::value_type{}; }; }; }; };
(void) []<typename T>() -> void{(void) []() -> void{(void) []() -> void{(void) []() -> void{(void) typename T::value_type{}; }; }; }; };
(void) []<typename T>() -> void{(void) []() -> void{(void) []() -> void{(void) [](cpp2::in<typename T::value_type> x) -> void{}; }; }; };
(void) []<typename T>() -> void{(void) []() -> void{(void) [](cpp2::in<typename T::value_type> x) -> void{(void) []() -> void{}; }; }; };
(void) []<typename T>() -> void{(void) [](cpp2::in<typename T::value_type> x) -> void{(void) []() -> void{(void) []() -> void{}; }; }; };
(void) []<typename T>(cpp2::in<typename T::value_type> x) -> void{(void) []() -> void{(void) []() -> void{(void) []() -> void{}; }; }; };
static_cast<void>([]<typename T>() -> void{static_cast<void>(typename T::value_type{}); });
static_cast<void>([]() -> void{static_cast<void>([]<typename T>() -> void{static_cast<void>(typename T::value_type{}); }); });
static_cast<void>([]() -> void{static_cast<void>([]() -> void{static_cast<void>([]<typename T>() -> void{static_cast<void>(typename T::value_type{}); }); }); });
static_cast<void>([]() -> void{static_cast<void>([]() -> void{static_cast<void>([]() -> void{static_cast<void>([]<typename T>() -> void{static_cast<void>(typename T::value_type{}); }); }); }); });
static_cast<void>([]() -> void{static_cast<void>([]() -> void{static_cast<void>([]<typename T>() -> void{static_cast<void>([]() -> void{static_cast<void>(typename T::value_type{}); }); }); }); });
static_cast<void>([]() -> void{static_cast<void>([]<typename T>() -> void{static_cast<void>([]() -> void{static_cast<void>([]() -> void{static_cast<void>(typename T::value_type{}); }); }); }); });
static_cast<void>([]<typename T>() -> void{static_cast<void>([]() -> void{static_cast<void>([]() -> void{static_cast<void>([]() -> void{static_cast<void>(typename T::value_type{}); }); }); }); });
static_cast<void>([]<typename T>() -> void{static_cast<void>([]() -> void{static_cast<void>([]() -> void{static_cast<void>([](cpp2::in<typename T::value_type> x) -> void{}); }); }); });
static_cast<void>([]<typename T>() -> void{static_cast<void>([]() -> void{static_cast<void>([](cpp2::in<typename T::value_type> x) -> void{static_cast<void>([]() -> void{}); }); }); });
static_cast<void>([]<typename T>() -> void{static_cast<void>([](cpp2::in<typename T::value_type> x) -> void{static_cast<void>([]() -> void{static_cast<void>([]() -> void{}); }); }); });
static_cast<void>([]<typename T>(cpp2::in<typename T::value_type> x) -> void{static_cast<void>([]() -> void{static_cast<void>([]() -> void{static_cast<void>([]() -> void{}); }); }); });

// Lookup.
{
using alias = std::integral_constant<cpp2::i32,0>;
(void) alias::value_type{0};// Non-dependent.
static_cast<void>(alias::value_type{0});// Non-dependent.
}
(void) []<typename T>(T const& _) -> void{
static_cast<void>([]<typename T>([[maybe_unused]] T const& param1) -> void{
using alias = std::integral_constant<T,0>;
(void) typename alias::value_type{0};// Dependent.
static_cast<void>(typename alias::value_type{0});// Dependent.
{
using alias = std::integral_constant<cpp2::i32,0>;
(void) typename alias::value_type{0};// Non-dependent.
static_cast<void>(typename alias::value_type{0});// Non-dependent.
}
}(0);
}(0));
}

0 comments on commit 58ee983

Please sign in to comment.