brintos

brintos / llvm-project-archived public Read only

0
0
Text · 822 B · 68e25dc Raw
37 lines · cpp
1// RUN: %clang_cc1 -std=c++2c -fexperimental-new-constant-interpreter -verify=expected,both %s2// RUN: %clang_cc1 -std=c++2c  -verify=ref,both %s3 4// both-no-diagnostics5 6namespace std {7inline namespace __1 {8template <class _Tp> class unique_ptr;9template <class _Tp> class unique_ptr<_Tp[]> {10public:11  _Tp* __ptr_;12 13public:14  constexpr _Tp&15  operator[](unsigned i) const {16    return __ptr_[i];17  };18};19} // namespace __120} // namespace std21struct WithTrivialDtor {22  int x = 6;23  constexpr friend void operator==(WithTrivialDtor const &x,24                                   WithTrivialDtor const &y) {25    (void)(x.x == y.x);26  }27};28constexpr bool test() {29 30  WithTrivialDtor array[50];31  std::unique_ptr<WithTrivialDtor[]> p(&array[0]);32  (void)(p[1] == WithTrivialDtor());33 34  return true;35}36static_assert(test());37