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
PR c++/56973, DR 696 - capture constant variables only as needed.
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
cpp1y
/
constexpr-local2.C
blob
fd6143b091eb1972312dc28d4d528a22ef03cd3b
1
// PR c++/64356
2
// { dg-do compile { target c++14 } }
3
4
typedef unsigned long size_t;
5
6
template<size_t N>
7
constexpr size_t f(const char (&x)[N]) {
8
size_t s = 0;
9
for(size_t c : x)
10
s += c;
11
return s;
12
}
13
14
template<size_t N>
15
constexpr size_t g(const char (&x)[N]) {
16
char y[N] = {0};
17
for(size_t i = 0; i < N; ++i)
18
y[i] = x[i];
19
return f(y);
20
}
21
22
constexpr auto x = g(__DATE__);