repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Add __builtion_unreachable to vector::size(), vector::capacity()
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
cpp1y
/
constexpr-99859-1.C
blob
dea5a5b56f807c556c4a0b108d4d7d47cf86c272
1
// PR c++/99859
2
// { dg-do compile { target c++14 } }
3
4
constexpr int
5
foo (int *x)
6
{
7
return ++*x;
8
}
9
10
struct S { constexpr S () : a(0) { foo (&a); foo (&a); } int a; };
11
constexpr S s = S ();
12
static_assert (s.a == 2, "");
13
14
struct R { int *p; };
15
16
constexpr int
17
bar (R x)
18
{
19
return ++*x.p;
20
}
21
22
struct T { int a = 0; constexpr T () { bar (R{&a}); bar (R{&a}); } };
23
constexpr T t = T ();
24
static_assert (t.a == 2, "");