Skip to content

Commit

Permalink
Move NoDefaultConstructor out of function
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokop committed May 8, 2024
1 parent c5b1890 commit ce79b94
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions core/unit_test/TestRealloc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ void impl_testRealloc() {
EXPECT_EQ(oldPointer, newPointer);
}
}
struct NoDefaultConstructor {
int value;
KOKKOS_FUNCTION
NoDefaultConstructor(int x) : value(x) {}
};

template <class DeviceType>
void testRealloc() {
Expand All @@ -156,11 +161,6 @@ void testRealloc() {
}
// Check #6992 fix (no default initialization in realloc without initializing)
{
struct NoDefaultConstructor {
int value;
KOKKOS_FUNCTION
NoDefaultConstructor(int x) : value(x) {}
};
using view_type = Kokkos::View<NoDefaultConstructor*, DeviceType>;
view_type view_1d_no_default(
Kokkos::view_alloc(Kokkos::WithoutInitializing, "view_1d_no_default"),
Expand Down
11 changes: 6 additions & 5 deletions core/unit_test/TestResize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,12 @@ void impl_testResize() {
}
}

struct NoDefaultConstructor {
int value;
KOKKOS_FUNCTION
NoDefaultConstructor(int x) : value(x) {}
};

template <class DeviceType>
void testResize() {
{
Expand All @@ -368,11 +374,6 @@ void testResize() {
WithoutInitializing>(); // without data initialization
}
{
struct NoDefaultConstructor {
int value;
KOKKOS_FUNCTION
NoDefaultConstructor(int x) : value(x) {}
};
using view_type = Kokkos::View<NoDefaultConstructor*, DeviceType>;
view_type view_1d_no_default(
Kokkos::view_alloc(Kokkos::WithoutInitializing, "view_1d_no_default"),
Expand Down

0 comments on commit ce79b94

Please sign in to comment.