Skip to content

Commit

Permalink
allow T* -> T const* but not Derived* -> Base*
Browse files Browse the repository at this point in the history
  • Loading branch information
XeCycle committed Apr 2, 2020
1 parent 23a8d45 commit 57667d0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ptr-iter-const-conv.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <type_traits>

static_assert(std::is_convertible_v<int (&)[], int const (&)[]>);

struct B {};
struct D : B {};

static_assert(std::is_convertible_v<D*, B*>);
static_assert(!std::is_convertible_v<D (&)[], B (&)[]>);
static_assert(std::is_convertible_v<D (&)[], D const (&)[]>);

0 comments on commit 57667d0

Please sign in to comment.