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-switch4.C
blob
383bde934be8113eeae8ad3c8bea640d98fe9d43
1
// PR c++/72868
2
// { dg-do compile }
3
// { dg-options "-std=gnu++14" }
4
5
constexpr int
6
foo (int i)
7
{
8
switch (i)
9
{
10
case 11 ... 12:
11
return 4;
12
case 0 ... 9:
13
return 3;
14
default:
15
return 7;
16
}
17
}
18
19
#define SA(X) static_assert((X),#X)
20
SA (foo (-1) == 7);
21
SA (foo (0) == 3);
22
SA (foo (3) == 3);
23
SA (foo (9) == 3);
24
SA (foo (10) == 7);
25
SA (foo (11) == 4);
26
SA (foo (12) == 4);
27
SA (foo (13) == 7);