Skip to content

Commit

Permalink
test: add test cases for dependent non-in parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
JohelEGP committed Oct 3, 2024
1 parent bd22b1e commit b15a82b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions regression-tests/pure2-bugfix-for-dependent-types.cpp2
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
identity: <T> type == T;

f: <T> (inout _: T::value_type) = { }
f: <T> (move _: T::value_type) = { }
f: <T, V: T::value_type> (x: T::value_type) -> T::value_type = {
assert(x is T::value_type);
y: T::value_type;
Expand Down
18 changes: 12 additions & 6 deletions regression-tests/test-results/pure2-bugfix-for-dependent-types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#line 1 "pure2-bugfix-for-dependent-types.cpp2"

#line 47 "pure2-bugfix-for-dependent-types.cpp2"
#line 49 "pure2-bugfix-for-dependent-types.cpp2"
template<typename T> class t;


Expand All @@ -18,16 +18,18 @@ template<typename T> class t;
template<typename T> using identity = T;
#line 2 "pure2-bugfix-for-dependent-types.cpp2"

template<typename T> auto f([[maybe_unused]] typename T::value_type& unnamed_param_1) -> void;
template<typename T> auto f([[maybe_unused]] typename T::value_type&& unnamed_param_1) -> void;
template<typename T, T::value_type V> [[nodiscard]] auto f(cpp2::impl::in<typename T::value_type> x) -> T::value_type;

#line 47 "pure2-bugfix-for-dependent-types.cpp2"
#line 49 "pure2-bugfix-for-dependent-types.cpp2"
template<typename T> class t {
struct u_x_as_base { typename T::value_type x; };

#line 48 "pure2-bugfix-for-dependent-types.cpp2"
#line 50 "pure2-bugfix-for-dependent-types.cpp2"
public: class u: public u_x_as_base, public T::type {

#line 51 "pure2-bugfix-for-dependent-types.cpp2"
#line 53 "pure2-bugfix-for-dependent-types.cpp2"
// Test that there's no `typename` in the member initializer list.
public: u(u const& that);
};
Expand All @@ -41,6 +43,10 @@ auto main() -> int;
#line 1 "pure2-bugfix-for-dependent-types.cpp2"

#line 3 "pure2-bugfix-for-dependent-types.cpp2"
template<typename T> auto f([[maybe_unused]] typename T::value_type& unnamed_param_1) -> void{}
#line 4 "pure2-bugfix-for-dependent-types.cpp2"
template<typename T> auto f([[maybe_unused]] typename T::value_type&& unnamed_param_1) -> void{}
#line 5 "pure2-bugfix-for-dependent-types.cpp2"
template<typename T, T::value_type V> [[nodiscard]] auto f(cpp2::impl::in<typename T::value_type> x) -> T::value_type{
if (cpp2::cpp2_default.is_active() && !(cpp2::impl::is<typename T::value_type>(x)) ) { cpp2::cpp2_default.report_violation(""); }
cpp2::impl::deferred_init<typename T::value_type> y;
Expand Down Expand Up @@ -85,12 +91,12 @@ template<typename T, T::value_type V> [[nodiscard]] auto f(cpp2::impl::in<typena
}
}

#line 52 "pure2-bugfix-for-dependent-types.cpp2"
#line 54 "pure2-bugfix-for-dependent-types.cpp2"
template <typename T> t<T>::u::u(u const& that)
: u_x_as_base{ that.x }
, T::type{ static_cast<typename T::type const&>(that) }{}

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

0 comments on commit b15a82b

Please sign in to comment.