aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor8.C
blob: 3048110ede37dbf36ba6a22f04fb436eb22adf2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// PR c++/97388
// { dg-do compile { target c++20 } }

struct S {
  int *s;
  constexpr S () : s(new int) {}
  S (const S &) = delete;
  S &operator= (const S &) = delete;
  constexpr ~S () { delete s; }	// { dg-error "already deallocated" }
};

constexpr bool
foo (S v)
{
  delete v.s;
  return true;
}

static_assert (foo (S ()));	// { dg-error "non-constant condition for static assertion" }