Sign in
gnu
/
gcc
/
93ac832f1846e4867aa6537f76f510fab8e3e87d
/
.
/
gcc
/
testsuite
/
g++.dg
/
cpp1y
/
constexpr-loop2.C
blob: 2e53e4831d3d6d3a36483024c28f3cedbf95bdd8 [
file
] [
log
] [
blame
]
// { dg-do compile { target c++14 } }
constexpr
int
f
(
int
*
p
)
{
return
*
p
;
}
constexpr
int
g
(
int
n
)
{
int
sum
=
0
;
for
(
int
i
=
1
;
i
<=
n
;
++
i
)
sum
+=
f
(&
i
);
return
sum
;
}
static_assert
(
g
(
3
)
==
3
+
2
+
1
,
""
);