aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit19.C
blob: 834dc631778e66536376b931b6eb0e4a7429cc97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// { dg-do compile { target c++23 } }

struct A { ~A(); };

struct B {
  constexpr B() {
    A a;
    for (int i = 0; i < 10; i++) { }
  } // { dg-error "call to non-'constexpr' function 'A::~A..'" }
};

constexpr bool f() {
  B b; // { dg-error "B::B..' called in a constant expression" }
  return true;
}

static_assert(f()); // { dg-error "non-constant" }