aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/is_literal_type3.C
blob: 4fede879a42a13c6b54dffba6fc10fc5e6f5d2f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// { dg-do compile { target c++11 } }

struct S {
  constexpr S () : n{} { }
  ~S () { n = 1; }
  int n;
};

#if __cpp_implicit_constexpr
static_assert(__is_literal_type(S), "");
#else
static_assert(!__is_literal_type(S), "");
#endif

#ifdef __cpp_constexpr_dynamic_alloc
struct T {
  constexpr T () : n{} { }
  constexpr ~T () { n = 1; }
  int n;
};

static_assert(__is_literal_type(T), "");

struct U : public T {
  constexpr U () : u{} { }
  int u;
};

static_assert(__is_literal_type(U), "");
#endif