blob: 7a73deed69310f4d934f88e62b955f55319c4a20 (
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
|
// PR c++/99859
// { dg-do compile { target c++20 } }
constexpr void
foo (int *x)
{
++*x;
}
constexpr int
bar ()
{
int *x = new int (0);
foo (x);
foo (x);
int y = *x;
delete x;
return y;
}
static_assert (bar () == 2);
struct R { int a, *b; };
constexpr void
baz (R x)
{
++*x.b;
}
constexpr int
qux ()
{
int *x = new int (0);
R r{1, x};
baz (r);
baz (r);
int y = *x;
delete x;
return y;
}
static_assert (qux () == 2);
|