Skip to content

Commit

Permalink
[libc++] Add some tests for std::bit_cast using pointers
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D154728
  • Loading branch information
ldionne committed Jul 7, 2023
1 parent 67b37af commit 1c83411
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,28 @@ bool tests() {
#endif
}

// Test pointers
{
{
int obj = 3;
void* p = &obj;
test_roundtrip_through_nested_T(p);
test_roundtrip_through_buffer(p);
test_roundtrip_through<void*>(p);
test_roundtrip_through<char*>(p);
test_roundtrip_through<int*>(p);
}
{
int obj = 3;
int* p = &obj;
test_roundtrip_through_nested_T(p);
test_roundtrip_through_buffer(p);
test_roundtrip_through<int*>(p);
test_roundtrip_through<char*>(p);
test_roundtrip_through<void*>(p);
}
}

return true;
}

Expand Down

0 comments on commit 1c83411

Please sign in to comment.