aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp/embed-3.C
blob: 7967511a01d8d3f990470efe4022b0a8299d25ba (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// { dg-do compile { target c++11 } }
// { dg-options "--embed-dir=${srcdir}/c-c++-common/cpp/embed-dir" }

template <int... N>
constexpr decltype (sizeof 0)
foo ()
{
  return sizeof... (N);
}

template <typename T, typename U>
struct same_type;
template <typename T>
struct same_type <T, T> {};

void
bar ()
{
}

template <typename U, typename... T>
same_type <U, int> *
bar (U u, T... t)
{
  bar (t...);
  return nullptr;
}

static_assert (
#embed <magna-carta.txt> limit (1) prefix (foo <) suffix (> () == 1, "")
);
static_assert (
#embed <magna-carta.txt> limit (2) prefix (foo <) suffix (> () == 2, "")
);
static_assert (
#embed <magna-carta.txt> limit (42) prefix (foo <) suffix (> () == 42, "")
);
static_assert (
#embed <magna-carta.txt> limit (521) prefix (foo <) suffix (> () == 521, "")
);

void
baz ()
{
  bar (
#embed "magna-carta.txt" limit (54)
      );
}